I have set up an OpenSSH server and try to connect using the following code:
(I'm no SSH expert, or even a novice)
var connectionInfo = new ConnectionInfo(host, 22, username, new PasswordAuthenticationMethod(username, password));
//var connectionInfo = new ConnectionInfo(host, 22, username, new KeyboardInteractiveAuthenticationMethod(username));
try
{
using (var client = new ScpClient(connectionInfo))
{
client.HostKeyReceived += delegate(object sndr, HostKeyEventArgs ex)
{
if (ex.FingerPrint.SequenceEqual(new byte[] { 0x2a, 0x08, 0xd5, 0x69, 0xe0, 0x9f, 0xcc, 0xdb, 0x3d, 0xc2, 0x78, 0x06, 0x61, 0xd0, 0xf4, 0xc4 }))
{
ex.CanTrust = true;
}
else
{
ex.CanTrust = false;
}
};
client.Connect();
// Do something here
client.Disconnect();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
but I get a "User cannot be authenticated exception. I can login fine with Putty and WinSCP. What could be the problem?(I'm no SSH expert, or even a novice)