在Cocoa app中运行ssh-askpass

时间:2015-09-17 04:10:56

标签: objective-c macos cocoa ssh ssh-keys

我试图在Cocoa app中运行SSHFS命令。我已经将SSHFS命令放在NSTask中,但是在执行命令时遇到了一些错误:

RSA host key for IP address 'xyz.com' not in list of known hosts.

ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory

Permission denied, please try again.

ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory

Permission denied, please try again.

ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory

Permission denied (publickey,password).

remote host has disconnected

mount_osxfusefs: failed to mount /Volumes/Drive_Test@/dev/osxfuse4: Socket is not connected

在这种情况下,我认为我的应用无法找到ssh_askpass。我的问题是如何运行此文件?任何建议将不胜感激。提前谢谢。

1 个答案:

答案 0 :(得分:1)

ssh-askpass是X11应用程序,与MacOS不直接兼容。您可以在同一路径中安装自定义ssh-askpass,尽管有点麻烦。 Here是一种实现,尽管我不能保证其完整性,安全性或与当前MacOS的兼容性。 (另请参见同一作者在https://jcs.org/notaweblog/2011/04/19/making_openssh_on_mac_os_x_more_secure上的博客,并尝试其他可能的方法。)

更好,更现代的解决方案是让MacOS钥匙串为您处理事情。参见例如SVN+SSH, not having to do ssh-add every time? (Mac OS)(显然不仅限于SVN)。

相关问题