This project is read-only.

Connect to linux server by SSH.NET library

Feb 22, 2014 at 6:00 AM

I'm new user of SSH.NET, I have some questions on it.
  1. How can I su my account by runcommand or runshell? I know it's an old question, but I didn't find a worked solution for me on the internet. Could you help?
  2. I'd like to execute a script on linux server, I have a sample code as below.
var ssh = new SshClient("ip", "user", "password");
var cmd = ssh .CreateCommand("./executescript");
var reader = new StreamReader(cmd.OutputStream);
var result = reader.ReadToEnd();

but I can't finish executing the script because it will ask a question like 'would you like to do that? yes or no', how can I send yes or no during executing the scripts?