Expand description
§remotefs-ssh
remotefs-ssh is a client implementation for remotefs, providing support for the SCP/SFTP protocols.
§Get started
First of all you need to add remotefs and the client to your project dependencies:
remotefs = "^0.3"
remotefs-ssh = "^0.5"
these features are supported:
find
: enablefind()
method for RemoteFs. (enabled by default)no-log
: disable logging. By default, this library will log via thelog
crate.
§Ssh client
Here is a basic usage example, with the Sftp
client, which is very similiar to the Scp
client.
ⓘ
// import remotefs trait and client
use remotefs::RemoteFs;
use remotefs_ssh::{SshConfigParseRule, SftpFs, SshOpts};
use std::path::Path;
let mut client: SftpFs = SshOpts::new("127.0.0.1")
.port(22)
.username("test")
.password("password")
.config_file(Path::new("/home/cvisintin/.ssh/config"), ParseRule::STRICT)
.into();
// connect
assert!(client.connect().is_ok());
// get working directory
println!("Wrkdir: {}", client.pwd().ok().unwrap().display());
// change working directory
assert!(client.change_dir(Path::new("/tmp")).is_ok());
// disconnect
assert!(client.disconnect().is_ok());
Structs§
- Ssh key method. Defined by
MethodType
(see ssh2 docs) and the list of supported algorithms. - SCP “filesystem” client
- Sftp “filesystem” client
- The parsing mode
- Ssh options; used to build and configure SCP/SFTP client.
Enums§
- Re-implementation of ssh key method, in order to use
Eq
- Ssh agent identity
Traits§
- This trait must be implemented in order to use ssh keys for authentication for sftp/scp.