SSH2 Crate Errors

Those docs are from a very old version of ssh2. Can you try the latest version, 0.8.2?

Very good point I overlooked. I should have lead with my tries from the newest version. I'm currently sick, awaiting a Covid test and pumped full of medicine. So I'm gonna blame it on that.

Here's the link I'm using from ssh2 - Rust under the "Run The Command" section looks like the following in my main function:

fn main() {
use std::io::prelude::*;
use std::net::{TcpStream};
use ssh2::Session;

// Connect to the local SSH server
let tcp = TcpStream::connect("192.168.x.x:22").unwrap();
let mut sess = Session::new().unwrap();
sess.set_tcp_stream(tcp);
sess.handshake().unwrap();
sess.userauth_agent("user").unwrap();

let mut channel = sess.channel_session().unwrap();
channel.exec("ls").unwrap();
let mut s = String::new();
channel.read_to_string(&mut s).unwrap();
println!("{}", s);
channel.wait_close();
println!("{}", channel.exit_status().unwrap());
}

This version compiles, but gives the following warning:

warning: unused `std::result::Result` that must be used
  --> src/main.rs:18:1
   |
18 | channel.wait_close();
   | ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: this `Result` may be an `Err` variant, which should be handled

    Finished release [optimized] target(s) in 2m 16s

When attempting to run it I get the following:

$ ./target/release/ssh2 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -39, msg: "no auth sock variable" }', src/main.rs:11:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm unsure if it was overlooked, but I confirmed I can login without a password from the source to the destination machine. I was also able to eventually get this going with a subprocess in this thread without hard-coding the path to the key. If you do think its needed I don't mind trying it if you'll show me where that should go in the code. Just wanted to make sure nothing was overlooked though.

Thanks!