Fail to Connect SFTP

Advertisement

tun.tuang31
Joined:
Posts:
1

Fail to Connect SFTP

Hello,

Connecting using winscp it self is OK, but i got a problem whent connecting to SFTP using winscp Library.
Below is the error i got when try to connect
Expected host key was not configured, use -hostkey switch.
Host key fingerprint is xxxx.
Authentication failed.
And this is my code, i got this using menu "Session>>Generate Session URL/code"
' Set up session options
        Dim sessionOptions As New SessionOptions
        With sessionOptions
            .Protocol = Protocol.Sftp
            .HostName = "xxx.net"
            .UserName = "username"
            .Password = "password"
            .SshHostKeyFingerprint = "ssh-rsa 1024 xxx"
        End With

        sessionOptions.AddRawSettings("Tunnel", "1")
        sessionOptions.AddRawSettings("TunnelHostName", "255.255.255.255")
        sessionOptions.AddRawSettings("TunnelUserName", "user")
        sessionOptions.AddRawSettings("TunnelPublicKeyFile", "C:%5CUsers%5CAdministrator%5CDesktop%5CFile.ppk")

        Using session As New Session
            ' Connect
            session.Open(sessionOptions)

            ' Your code
        End Using

Please advice how to fix this,

Thank you

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum