supplied public key was not accepted by the server or user name is incorrect

0 votes
asked Feb 1, 2011 by Vision.v1 (120 points)
edited Jan 23, 2012

Hi,

I can able to connect to SFTP site successfully using the following credentials Using the FILEZILLA.exe

Host : 411:216:217:453, Server Type : SFTP - SSH File Transfer Protocol, LogonType: Normal, user:mysite

password:(Not required any password to connect)

recently i downloaded RebexSftp-Trial-2.0.3854.0-DotNet2.0, If it works i want to buy the product but am getting the error message "supplied public key was not accepted by the server or user name is incorrect" using the below code:

Am passing the correct user name value

Sftp client = new Sftp();

client.Connect("411:216:217:453");

SshPrivateKey privatekey = new SshPrivateKey(@"C:\Documents and settings\Vision.v1\Desktop\SFTP\smfiles_sshkey_1.ppk",null);

string password = "";

client.Login("mysite", privatekey);

but am not able to connect, am using this component for the first time...

below is the cipher information:

SshCipher cipher = client.Session.Cipher;

  • Host key algorithm: DSS

    Key exchange algorithm: DiffieHellmanGroupExchangeSHA1

    Incoming MAC algorithm: SHA1

    Incoming cipher: AES

    Outgoing MAC algorithm: SHA1

    Outgoing cipher: AES

    Summary: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes128-ctr/aes128-ctr, SH A1/SHA1

A supplied public key was not accepted by the server or the user name is incorrect.

BELOW IS THE LOG FILE INFORMATION:

2011-02-02 10:53:20.288 Opening log file. 2011-02-02 10:53:20.882 ERROR Sftp(1) Info: Rebex.Net.SshException: A supplied public key was not accepted by the server or the user name is incorrect. at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials ) at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey) at Rebex.Net.Sftp.Login(String userName, String password, SshPrivateKey privateKey

Please advise me, if need to do any changes in the code...

Thaks in advance....

Applies to: Rebex SFTP
commented Feb 2, 2011 by Lukas Pokorny (102,170 points)
Are you sure you are using the same key file with Rebex SFTP as If the username is correct, this error should only be thrown if the server doesn't accept the public key part of your key. Are you sure this is the same key you use in FileZilla?
commented Feb 2, 2011 by Lukas Pokorny (102,170 points)
Please create a communication log using Sftp object's LogWriter property (as described at http://www.rebex.net/kb/logging.aspx) and either add it to your post or mail it to support@rebex.net - we might be able to spot some problem there.
commented Feb 2, 2011 by Vision.v1 (120 points)
please see the below log information..... 2011-02-02 10:53:20.288 Opening log file. 2011-02-02 10:53:20.882 ERROR Sftp(1) Info: Rebex.Net.SshException: A supplied public key was not accepted by the server or the user name is incorrect. at Rebex.Net.SshSession.cCIjvV(String , String , SshPrivateKey , SshGssApiCredentials ) at Rebex.Net.SshSession.Authenticate(String userName, String password, SshPrivateKey privateKey) at Rebex.Net.Sftp.Login(String userName, String password, SshPrivateKey privateKey)
commented Feb 2, 2011 by Vision.v1 (120 points)
Yes am using the same key file with Rebex Sftp and FileZilla with the extension of the key as .ppk

1 Answer

+1 vote
answered Jan 23, 2012 by Patrick Peters (160 points)
edited Jan 23, 2012

Make sure you register the public key to the remote SSH server you are connecting to.

...