Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinSCP SFTP connection error

While accessing my remote server, from SFTP, I am constantly getting this error

Connection has been unexpectedly closed. Server sent command exit status 0

I have filled same credentials in WinSCP, it is working fine. Where am I lacking? Also, instead of .ppk file I am using "ssh-rsa 1024 #######################" in my keyfile column in my project's UI.

Thank You,
Pranay

like image 779
Pranay Deep Avatar asked Oct 18 '22 21:10

Pranay Deep


1 Answers

For the problem above, I found that while attempting to "open the session" i.e session.Open(sessionOptions), it will through the exception as the server was not authenticating it.

As my task was to "password less winscp login", i.e i must have to provide:- 1.".ppk" file that is "puTTy private key". 2. Its "ssh key fingerprint".

After all day debugging, finally found that my version of winsscp.dll was old thus was not providing me the [metadata] inbuild properties as 1. SshPrivateKeyPath -> location of our ".ppk" file. 2. SshHostKeyFingerprint 3. passphrase -> only for one time login.

By updating the new version and above now I am able to open session, without any error.

Thank you.

like image 184
Pranay Deep Avatar answered Oct 21 '22 16:10

Pranay Deep