This project is read-only. no output

Apr 8, 2012 at 12:07 AM

im using SSH.NET as one of my libraries to access a machine via SSH protocol, so here, I tried creating some code, but ended up no output

using (var client = new SshClient("", "root", "password"))
var cmd = client.RunCommand("cd /etc/openvpn");
var cmd1 = client.RunCommand("vi log.log");
var cmd2 = client.RunCommand("/In case of rekeying this note is ok");
string message = cmd2.Error;


basically, what Im trying to achieve is login, change directory, use vi to search contents of a file and get the error message. I debug and build it but it doesnt continue (no output), maybe it hangs somewhere. What could have gone wrong in the code? Thanks

Apr 9, 2012 at 5:50 PM

You should check for command properties since this is where you should see the result of command execution.

Also, you cannot use cd in command context, well, you can, but it will not have any effect on the next command.




Apr 10, 2012 at 4:11 AM

Sent from my iPhone
Apr 20, 2012 at 2:24 AM

try as fllow

var cmd1 = client.RunCommand("cd /etc/openvpn; vi log.log");