c# - Connecting to SFTP with key file using SSH.NET (Permission denied (publickey)) -
i have c# console application in visual studio 2008 , .net framework 3.5.
for testing purposes, have installed ftp server in local machine , configure it. have downloaded , installed free small ftp server: freeftpd. easy, takes me 10 minutes.
once have configured it, have connected using passworda uthentication method using c# console app.
now trying connect local ftp server using key based file only.
so code have implemented following:
var keyfile = new privatekeyfile(@"c:\program files (x86)\freeftpd\freeftpd.key"); var keyfiles = new[] { keyfile }; var methods = new list<authenticationmethod>(); methods.add(new privatekeyauthenticationmethod(username, keyfiles)); var con = new connectioninfo(host, port, username, methods.toarray()); using (sftpclient client = new sftpclient(con)) { client.connect(); // stuff below }
as can see in above code, using freeftpd.key private key file. file has been created once freeftpd installed. during installation, freeftpd asked me create new private key file answered 'yes'. using problem can connect ftp local server using private key file. have opened file, , starts following line:
-----begin rsa private key-----
and ends with:
-----end rsa private key-----
below them there bunch of encrypted data.
i have read somewhere file must begin line.
anyway cannot connect ftp server.
from freeftpd control panel, in section sftp, can create rsa , dsa keys (512, 1024 or 2048 bits of lenght). these files generated rsakey.cfg , dsakey.cfg , content similar private key file 'freeftpd.key' generated during freeftpd installation process. if use rsakey.cfg or other created freeftpd not working. error message appears is:
permission denied (publickey).
so doing wrong? have no idea certificates, private key files... highly appreciated.
i don't have experience freeftpd wonder if issue same here: http://www.sitecorelessons.com/2014/03/how-to-upload-file-via-sftp-using.html
from link: "note:- private key must compatible sshnet. convert private key sshnet compatible private key, refer other article how convert private key openssh key connect sftp server."
C - Connecting To Sftp With Key File Using Ssh.Net (Permission Denied
ReplyDelete(Publickey)) - >>>>> Download Now
>>>>> Download Full
C - Connecting To Sftp With Key File Using Ssh.Net (Permission Denied
(Publickey)) - >>>>> Download LINK
>>>>> Download Now
C - Connecting To Sftp With Key File Using Ssh.Net (Permission Denied
(Publickey)) - >>>>> Download Full
>>>>> Download LINK FV