I am attempting to open a simple SSH connection to a Mac OS PC from my .Net code using the SSH.NET library. It works flawlessly when attempting to connect to a Linux PC but fails when attempting to connect to a Mac. Here's my code:
SshClient ssh = new SshClient("myURL", 22, "myUsername", "myPass);
{
ssh.Connect();
var result = ssh.RunCommand("df -h");
ssh.Disconnect();
}
The log file mentions: Apr 20 18:12:56 mac com.apple.xpc.launchd[1] (com.openssh.sshd.FA1D901D-E641-4515-B43B-8E15B3478633[2059]): Service exited with abnormal code: 1
On Visual Studio I am getting the following error when running: No suitable authentication method found to complete authentication.
Ran across the same problem as .Net for a Node.js ssh connection , but here is how I fixed it on Yosemite.10.10.5
sudo vi /private/etc/sshd_config
set PasswordAuthentication to yes PasswordAuthentication yes
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
好了,设法找到了解决方案:在这种情况下,您应该转到Mac的sshd_config文件,将“ PasswordAuthentication no”更改为“ PasswordAuthentication yes”,然后将其取消引用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.