Crate remotefs_ssh

Source
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: enable find() method for RemoteFs. (enabled by default)
  • no-log: disable logging. By default, this library will log via the log 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§

Enums§

Traits§

  • This trait must be implemented in order to use ssh keys for authentication for sftp/scp.