.net - ssh.net library - client.RunCommand() is not working -


the program hangs @ .runcommand(). missing basic? seems same code works other people , know command correct.

if comment out .runcommand() program executes without error.

static void main(string[] args)     {        privatekeyfile key = new privatekeyfile("private");        using (var client = new sshclient("host", "user", key))         {             client.connect();             client.runcommand("command");             client.disconnect();         }     } 

i appreciate in advanced.

it helpful know you're trying connect to. also, may want checking errors in code. don't seem have in place validating you've connected... start there. change username , password should fail , see if see error.

i've tried number of different ssh libraries, perl, python, .net, name automating changes networking devices. common thing came across connecting work, logins worked fine, attempting pass command either time out or fail. looked using different versions of ssh didn't seem make difference. devices seem require sending either "\n" or "\l\r" prior accepting commands. things work using linux box test server, connecting switch or wap not allow me pass commands.

in end, gave , cobbled using autoit or tried using telnet - bad idea in environments, perl, python, , .net work wonderfully telnet connections. php well.

i wasn't able pass commands in using ssh scripts (flat text files containing commands passed on successful login) supported number of applications ( putty, think, , openssh ).


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -