I have a remote server running Windows 2022 with OpenSSH Client and OpenSSH Server installed. I am able to connect to the remote machine with RDP with an Admin account and everything looks like it is correct. Services are installed and running. However, when I try to connect to the same server from my local machine I get a permission denied error.
I am trying to connect using a .NET application using the SSH.Net library but also am trying with command prompt and get the same error either way saying "Permission denied, please try again". I am typing in the host, username and password the same as I do in RDP.
Here is my .NET code which I wrote based on this article: https://codeburst.io/working-with-sftp-in-net-core-f1f464ab06f8 This fails at the client.Connect with the error of:
var client = new SftpClient(sftpConfiguration.Host, sftpConfiguration.Port, sftpConfiguration.Username, sftpConfiguration.Password);
using (client)
{
try
{
client.Connect();
var files = client.ListDirectory(sftpConfiguration.RemotePath);
foreach (var file in files)
{
}
return files;
}
catch (Exception exception)
{
client.Disconnect();
logger.LogError(exception, $"Failed in listing files under [{sftpConfiguration.RemotePath}]");
return null;
}
finally
{
client.Disconnect();
}
}
Here is my command prompt:
Are there configurations that I am missing for the OpenSSH Server?