Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Guest

You need to convert your OpenSSH key to PuTTY format. Use PuTTYgen tool.
OpenSSH SSH2 private key
stephen.terrones

.NET SFTP Authentication Failing

I can access this SFTP through CyberDuck and from the Command Line, however in my .NET application, WinSCP is having difficulty and I'm not sure what is wrong. I'm using the same Private SSH Key file, the same username, the same url, but it won't authenticate. Please advise. I have attached a WinSCP log file. Below is the code.
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = WinSCP.Protocol.Sftp,
    HostName = "t-4c0g77558b264asdf.server.transfer.us-east-1.amazonaws.com",
    UserName = "username",
    SshPrivateKeyPath = "C:/FOLDER/DIRECTORY/.ssh/Key",
    GiveUpSecurityAndAcceptAnySshHostKey = true,
    PortNumber = 22,
    SshHostKeyPolicy = SshHostKeyPolicy.GiveUpSecurityAndAcceptAny
};
 
using (Session session = new Session())
{
    session.SessionLogPath = "C:/FOLDER/DIRECTORY/.ssh/log";
    session.DebugLogPath = "C:/FOLDER/DIRECTORY/.ssh/debug";
 
    try
    {
        session.Open(sessionOptions);
    }
    catch(Exception e)
    {
    }
}