Topic "Authentication failed with SFTP"

Author Message


I have troubles when I try to connect with SFTP Protocol.
My computer is running on Windows 10.

Here's the message I get (translated from French)
Authentication failed!
WinSCP.SessionRemoteException: Unexpected log out. Result of the exit command on the server 0
Authentication log:
Using user name: "xxx"
Authentication with public key "xxx"

And this is what I have in the end of the log file:
. 2016-06-23 14:19:50.374 Reading key file "xxx"
! 2016-06-23 14:19:50.375 Using username "xxx".
. 2016-06-23 14:19:50.452 Offered public key
. 2016-06-23 14:19:50.530 Offer of public key accepted
! 2016-06-23 14:19:50.530 Authenticating with public key "xxx"
. 2016-06-23 14:19:50.530 Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "xxx": ")
. 2016-06-23 14:19:50.530 Disconnected: Unable to authenticate

I have a "-" in the password, could it be the cause of the error?

Thanks for your help Smile
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
No the "-" should not be a problem.
Are you able to connect with any other SSH or SFTP client using this private key?


I can connect with FileZilla and WinSCP, but not with a SFTP client.

Here is a part the VB code of my client:

Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Sftp
.HostName = "xxx"
.UserName = "xxx"
.Password = "xxx"
.SshHostKeyFingerprint = "xxx"
.SshPrivateKeyPath = "C:\xxx\PrivateKey.ppk"
.AddRawSettings("AuthKI", "0")
End With

Using session As New Session
session.SessionLogPath = "C:\xxx\logwinscp.txt"
' Connect
End Using
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Show us a log file from FileZilla.

What does it mean "I can connect with ... WinSCP, but not with a SFTP client"?
Martin Prikryl


Sorry if I wasn't very clear.
I could connect with FileZilla and a SFTP Client Like WinSCP software, but I could't do it with my code.
I took the one generated by WinSCP software.

I found my mistake finally, in this code I didn't need the password but the PrivateKeyPassphrase. I mingled theses 2.

Thanks for help Smile

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License