"An established connection was aborted by the software in your host machine." after establishing a SSH connection to a juniper firewall

Apr 5, 2013 at 9:31 AM
hello!

I am trying to execute some commands on a Juniper SSG 350M (with default settings, but ssh enabled on all interfaces) Firewall, after establishing a ssh connection... but I always get the same error:

"An established connection was aborted by the software in your host machine."

My code looks as follows:
ConnectionInfo connInfo = new PasswordConnectionInfo(host, 22, username, password);

connInfo.Timeout = TimeSpan.FromMinutes(30);
                                
SshClient client = new SshClient(connInfo);

try
{
    client.Connect();
}
catch (Exception ex)
{
    textBox1.Text += "++++++++++++++++" + ex.StackTrace.ToString() + "\r\n";
    textBox1.Text += "++++++++++++++++" + ex.Message.ToString() + "\r\n";
}
//textBox1.Text += client.ConnectionInfo.GetType();
String command = "get system version";
                                    
SshCommand cmd99 = null;
try
{

    cmd99 = client.RunCommand(command);
}
catch (Exception ex)
{
    textBox1.Text += "######################" + ex.StackTrace.ToString() + "\r\n";
    textBox1.Text += "######################" + ex.Message.ToString() + "\r\n";
}
client.Disconnect();
After executing the code, the exception occurs at the client.RunCommand(command) line. My output:

Starting SSH Connection to 192.168.1.1
at Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle)
at Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle)
at Renci.SshNet.Channels.ChannelSession.SendExecRequest(String command)
at Renci.SshNet.SshCommand.BeginExecute(AsyncCallback callback, Object state)
at Renci.SshNet.SshCommand.Execute()
at Renci.SshNet.SshClient.RunCommand(String commandText)
at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\dsteiner\Documents\Visual Studio 2010\Projects\SSHNET-Connector\WindowsFormsApplication1\Form1.cs:line 140
An established connection was aborted by the software in your host machine.
Connection to 192.168.1.1 closed



The juniper firewall system log writes:

2013-04-05 19:00:39 warn SCP: Admin 'netscreen' at host 192.168.1.99 executed invalid scp command: 'get system version'.
2013-04-05 19:00:39 warn SSH: Password authentication successful for admin user 'netscreen' at host 192.168.1.99.


So I think that the connection was successful, but the command isn't working. Why? Is it because the RunCommand executes a SCP-command (see firewall log)?

please help me. thank you