Is it possible to work on normal (not SFTP) FTP on Renci SSH.NET? - which client to use?

Peter PitLock picture Peter PitLock · Mar 1, 2016 · Viewed 10.3k times · Source

I am using Renci SSH.NET, but trying to test on a FTP (not SFTP site).

I did get this working with WinSCP - but cannot get it to work on Renci - WinSCP allows me to set the protocol to either FTP or SFTP - I think this is the issue - I am prompted for

No suitable authentication method found to complete authentication (publickey,keyboard-interactive).

How do I turn off SFTP (and just use FTP) on Renci SSH.NET? I tried

Dim c As Renci.SshNet.SftpClient /  ScpClient/ BaseClient / NetConfClient

here is code:

Private Sub LancerUpload()

    Dim PWAuthMeth = New PasswordAuthenticationMethod(Login, Password)
    Dim KIAuthMeth = New KeyboardInteractiveAuthenticationMethod(Login)
    AddHandler KIAuthMeth.AuthenticationPrompt, AddressOf HandleKeyEvent
    Dim ConnectionInfo As New ConnectionInfo(ServerName, 22, Login, PWAuthMeth, KIAuthMeth)
    Dim SshClient1 As New SshClient(ConnectionInfo)

    Try
        SshClient1.Connect()
    Catch ex As Exception
        MsgBox(ex.ToString())
    End Try

    MsgBox(SshClient1.IsConnected)

End Sub

Private Sub HandleKeyEvent(sender As Object, e As Renci.SshNet.Common.AuthenticationPromptEventArgs)
    For Each prompt As Renci.SshNet.Common.AuthenticationPrompt In e.Prompts
        If prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) <> -1 Then
            prompt.Response = Password
        End If
    Next
End Sub

Answer

Martin Prikryl picture Martin Prikryl · Mar 1, 2016

As the name says, the Renci SSH.NET library is an SSH library.

The FTP has nothing to do with the SSH nor the SFTP. Contrary to the SFTP, what in an subsystem of the SSH.

So no, you cannot use the Renci SSH.NET for the FTP protocol.

You may want to read Is "SFTP" and "Ftp over SSL" a same thing? and Differences between SFTP and "FTP over SSH".