Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Bindings to libssh. Unrelated to libssh2 (which also has rust bindings, see the "ssh2" crate),
Libssh is a client and server library supporting both versions 1 and 2 of the SSH protocol. The client part follows the behavior of openssh closely, in particular it parses ~/.ssh/config, and accepts ProxyCommand directives automatically.
Although this binding is Apache/MIT-licensed, libssl itself is released under the LGPL. Make sure you understand what it means if you plan to link statically (this crate links dynamically by default).
Client examples
use ssh::*;
let mut session=Session::new().unwrap();
session.set_host("pijul.org").unwrap();
session.parse_config(None).unwrap();
session.connect().unwrap();
println!("{:?}",session.is_server_known());
session.userauth_publickey_auto(None).unwrap();
Running a command on a remote server
`` use ssh::*; use std::io::Read;
let mut session=Session::new().unwrap(); session.set_host("pijul.org").unwrap(); session.parse_config(None).unwrap(); session.connect().unwrap(); println!("{:?}",session.is_server_known()); session.userauth_publickey_auto(None).unwrap(); { let mut s=session.channel_new().unwrap(); s.open_session().unwrap(); s.request_exec(b"ls -l").unwrap(); s.send_eof().unwrap(); let mut buf=Vec::new(); s.stdout().read_to_end(&mut buf).unwrap(); println!("{:?}",std::str::from_utf8(&buf).unwrap()); } ``
Creating a remote file
`` use ssh::*; use std::io::Write;
let mut session=Session::new().unwrap(); session.set_host("pijul.org").unwrap(); session.parse_config(None).unwrap(); session.connect().unwrap(); println!("{:?}",session.is_server_known()); session.userauth_publickey_auto(None).unwrap(); { let mut scp=session.scp_new(WRITE,"/tmp").unwrap(); scp.init().unwrap(); let buf=b"blabla blibli\n".to_vec(); scp.push_file("blublu",buf.len(),0o644).unwrap(); scp.write(&buf).unwrap(); } ``
Creating a remote directory with a file inside
`` use ssh::*; use std::io::Write;
let mut session=Session::new().unwrap(); session.set_host("pijul.org").unwrap(); session.parse_config(None).unwrap(); session.connect().unwrap(); println!("{:?}",session.is_server_known()); session.userauth_publickey_auto(None).unwrap(); { let mut scp=session.scp_new(RECURSIVE|WRITE,"/tmp").unwrap(); scp.init().unwrap(); scp.push_directory("testdir",0o755).unwrap(); let buf=b"blabla\n".to_vec(); scp.push_file("test file",buf.len(),0o644).unwrap(); scp.write(&buf).unwrap(); }
``
Reading a remote file
`` use ssh::*; use std::io::Read;
let mut session=Session::new().unwrap(); session.set_host("pijul.org").unwrap(); session.parse_config(None).unwrap(); session.connect().unwrap(); println!("{:?}",session.is_server_known()); session.userauth_publickey_auto(None).unwrap(); { let mut scp=session.scp_new(READ,"/tmp/blublu").unwrap(); scp.init().unwrap(); loop { match scp.pull_request().unwrap() { Request::NEWFILE=>{ let mut buf:Vec=vec!(); scp.accept_request().unwrap(); scp.reader().read_to_end(&mut buf).unwrap(); println!("{:?}",std::str::from_utf8(&buf).unwrap()); break; }, Request::WARNING=>{ scp.deny_request().unwrap(); break; }, _=>scp.deny_request().unwrap() } } } ``