I'm using the SSH.NET library to connect to a remote SFTP server. I'm trying to use very basic code but it's not working
using (var client = new SftpClient(host, username, password))
{
client.Connect();
client.ChangeDirectory(@"sftp://server.example.com/other_directory");
}
However, this throws an exception saying No Such File
on the ChangeDirectory
method.
I tried the same with Curl but got an error saying
curl: (51) SSL peer certificate or SSH remote key was not OK
However, I added curl's --insecure argument and everything worked fine.
Could the --insecure
part be related to why the SSH.NET
library isn't working or is there another reason? Is there a way to simulate what --insecure
does in C#?
Thanks
sftp://server.example.com/
is denying you a secure connection. So it may be a configuration issue, and not anything you're doing wrong on the client side.