This project is read-only.

Mutil Connect SSH Client Error "SSH_MSG_USERAUTH_FAILURE"

Oct 21, 2013 at 3:51 PM
Edited Oct 21, 2013 at 3:55 PM
I write a code to connect ssh server.
I use Foreach to make a loop connect to server from a list SSH
But my get error with list.
But when i run only one ssh then connect success "SSH_MSG_USERAUTH_SUCCESS"
I think SSH client do not work with Loop
Please take a look my code. And thanks reader for help :)
 class SSH 
        {
            string server;
            string username;
            string password;

        }

        void multilConnect()
        {
            uint portDynamic = 1;
            foreach (SSH ssh in SSHs)
            {
                SshClient client = new SshClient(ssh.server, ssh.username, ssh.password);
                client.Connect();
                if (client.IsConnected)
                {
                    ForwardedPortDynamic f = new ForwardedPortDynamic("127.0.0.1", portDynamic);
                    f.Start();
                    //Do something with web client support Socks 4/5 via 127.0.0.1/portDynamic 
                   
                }

                portDynamic += 1;
            }
        }
And Error
SshNet.Logging Verbose: 1 : Initiating connect to '8.4.116.229:22'.
SshNet.Logging Verbose: 1 : Server version '2.0' on 'dropbear_0.51'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'KeyExchangeInitMessage': 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 1 : SendMessage to server 'KeyExchangeInitMessage': 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 1 : SendMessage to server 'KeyExchangeDhInitMessage': 'SSH_MSG_KEXDH_INIT'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'KeyExchangeDhReplyMessage': 'SSH_MSG_KEXDH_REPLY'.
SshNet.Logging Verbose: 1 : SendMessage to server 'NewKeysMessage': 'SSH_MSG_NEWKEYS'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'NewKeysMessage': 'SSH_MSG_NEWKEYS'.
SshNet.Logging Verbose: 1 : SendMessage to server 'ServiceRequestMessage': 'SSH_MSG_SERVICE_REQUEST'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ServiceAcceptMessage': 'SSH_MSG_SERVICE_ACCEPT'.
SshNet.Logging Verbose: 1 : SendMessage to server 'RequestMessageNone': 'SSH_MSG_USERAUTH_REQUEST'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'FailureMessage': 'SSH_MSG_USERAUTH_FAILURE'.
SshNet.Logging Verbose: 1 : SendMessage to server 'RequestMessagePassword': 'SSH_MSG_USERAUTH_REQUEST'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'FailureMessage': 'SSH_MSG_USERAUTH_FAILURE'.
A first chance exception of type 'Renci.SshNet.Common.SshAuthenticationException' occurred in Renci.SshNet.dll