SFTP Keyboard Interactive Authentication

May 22, 2013 at 1:02 PM
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?