Discuss the FTP protocol, secure FTP, FTP over SSH and FTP over SSL.
no avatar
User

android2903

Posts

3

Joined

Fri Jan 24, 2014 5:34 am

SSH_MSG_USERAUTH_FAILURE error

by android2903 » Fri Jan 24, 2014 5:47 am

I am trying to setup sftp with third party ftp server, I have provided them my public key and they have registered on their server and I have written their public key in my knowhost file. Now I am trying to connect to ftp server through code :


_ftpConnection.ServerAddress = ServerAddress;
_ftpConnection.UserName = UserName;
_ftpConnection.Password = Password; //Passwordis blank as I am using Authentication type publickey
_ftpConnection.Protocol = FTPProtocol.SFTP;
_ftpConnection.AuthenticationMethod = AuthenticationType.PublicKey;
_ftpConnection.ClientPrivateKeyFile = pathToKey; //Path to my private key
_ftpConnection.ClientPrivateKeyPassphrase = passphrase; // pass phrase used to generate my private key
_ftpConnection.UseSFTPServerValidation = true;
_ftpConnection.KnownHosts.KnownHostFile = knownHostFilePath;
_ftpConnection.Connect();

It fails when it tries to connect and throw exception "AuthentiationFailed". Here's the attached trace below:

DEBUG [SSHFTPClient] 23 Jan 2014 12:44:11.323 : HostKeyChecker checking for ssh-
rsa public key of 'sft.XXXXYYYY.com'
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.325 : Processed SSH_MSG_KEXDH_IN
IT reply successfully
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.326 : Sending SSH_MSG_NEWKEYS
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.327 : Sent SSH_MSG_NEWKEYS
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.329 : Established ciphers
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.330 : Established MACs
DEBUG [ClientKeyExchanger] 23 Jan 2014 12:44:11.330 : Reading SSH_MSG_NEWKEYS re
ply
DEBUG [AbstractKeyExchanger] 23 Jan 2014 12:44:11.331 : Processing SSH_MSG_NEWKE
YS reply
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.332 : Processed 0 queued messages
DEBUG [AbstractKeyExchanger] 23 Jan 2014 12:44:11.332 : Processed SSH_MSG_NEWKEY
S reply
INFO [AbstractKeyExchanger] 23 Jan 2014 12:44:11.332 : Negotiated new keys succe
ssfully
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.333 : Key exchange complete
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.336 : Sent SSH_MSG_SERVICE_REQUEST '
ssh-userauth'
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.336 : Waiting for packet
DEBUG [PlainSocket] 23 Jan 2014 12:44:11.391 : RepeatCallback received 52 bytes
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.392 : Packet arrived
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.394 : Starting user authentication
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.394 : Public key authentication
INFO [PuTTYPrivateKeyFormat] 23 Jan 2014 12:44:11.397 : Unpacking puTTY formatte
d private key
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.469 : Sent SSH_MSG_USERAUTH_REQUEST
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.471 : Waiting for packet
DEBUG [PlainSocket] 23 Jan 2014 12:44:11.570 : RepeatCallback received 76 bytes
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.571 : Packet arrived
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.572 : ProcessAuthenticationResponse:
SSH_MSG_USERAUTH_FAILURE
ERROR [SSH2Connection] 23 Jan 2014 12:44:11.572 : Auth failure. Try: password,publickey,keyboard-interactive
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.573 : Starting user authentication
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.573 : Password authentication
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.574 : Sent SSH_MSG_USERAUTH_REQUEST
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.574 : Waiting for packet
DEBUG [PlainSocket] 23 Jan 2014 12:44:11.600 : RepeatCallback received 76 bytes
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.601 : Packet arrived
DEBUG [SSH2Connection] 23 Jan 2014 12:44:11.601 : ProcessAuthenticationResponse:
SSH_MSG_USERAUTH_FAILURE
ERROR [SSH2Connection] 23 Jan 2014 12:44:11.602 : Auth failure. Try: password,pu
blickey,keyboard-interactive
ERROR [SSHFTPClient] 23 Jan 2014 12:44:11.608 : Failed to connect - closing conn
ection
ERROR [SSHFTPClient] 23 Jan 2014 12:44:11.608 : EnterpriseDT.Net.Ftp.Ssh.SFTPExc
eption: AuthenticationFailed
ERROR [SSHFTPClient] 23 Jan 2014 12:44:11.608 : at EnterpriseDT.Net.Ftp.Ssh.S
SHFTPClient.Connect()
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: SSH_MSG_USERAUTH_FAILURE error

by support2 » Fri Jan 24, 2014 7:56 am

Have you verified you can authenticate using your private key using another client like WinSCP?
no avatar
User

android2903

Posts

3

Joined

Fri Jan 24, 2014 5:34 am

Re: SSH_MSG_USERAUTH_FAILURE error

by android2903 » Fri Jan 24, 2014 8:28 am

I tried and got this error

no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: SSH_MSG_USERAUTH_FAILURE error

by support2 » Fri Jan 24, 2014 8:55 am

You'll need to talk to the server administrator - I don't know what that error means.
no avatar
User

android2903

Posts

3

Joined

Fri Jan 24, 2014 5:34 am

by android2903 » Fri Jan 24, 2014 9:05 am

Is this shows that the server doesn't have my public key registered.
Also I am not giving password while login into winscp. Only username and private key of mine.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Fri Jan 24, 2014 11:21 am

Yes, it looks like your public key is not registered.

Who is online

Users browsing this forum: No registered users and 24 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron