As I would like to start a small piece of the snippet to make the actual logic to prototype. I began to identify the ssh frameworks that I can utilize in my application. During that exploration time, I found a shortcut which is easy to achieve at every first level.
The idea is to use the ssh command available in the os. This code is very simple and attracts the rust beginners.
This snippet calling the ssh terminal command and passing the required argument
that is actually my username and server host.
use std::process::Command; fn main() { let username = "<Fillup>"; let hostname = "<Fillup>"; let cmd_out = Command::new("ssh") .arg(format!("{}@{}",username,hostname)) .output(); match cmd_out { Ok(o) => { let l = format!( "{}{}", String::from_utf8_lossy(&o.stdout), String::from_utf8_lossy(&o.stderr) ); if o.status.success() { println!("{}", l); } } Err(e) => { println!("{}", e); } } }
So the question is still open, did I complete the SSH application?
Now it is in WIP, once completed let you know.
No comments:
Post a Comment