Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: SFTP Keyboard Interactive Authentication

$
0
0
Hi,

I'm trying to get files via sftp, but I can figure out which classes I need to use.
At first I tried to connect by simply using an SftpClient object, like shown in an example I found

    using (var sftp = new SftpClient(host, username, password))
    {
        sftp.Connect();

        using (var file = File.OpenRead(localFileName))
        {
            sftp.UploadFile(remoteFileName, file);
        }https://sshnet.codeplex.com/discussions/create#

        sftp.Disconnect();
    }
but sftp.Connect(); throws an SSHAuthenticationException;

Connecting to the server via putty i recognized it uses keyboard-interactive authentication and tried to creat the SftpClient like this:
            KeyboardInteractiveConnectionInfo conInfo = new KeyboardInteractiveConnectionInfo(host, port, username);

            SftpClient client = new SftpClient(conInfo);
            client.Connect();
Which throws an ArgumentNullException.

Whats the right way to creat an SftpClient connection?

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>