cygWin 使用 RSA 密钥通过 SSH 连接;ssh.exe 无法创建 /home/user/.ssh

cygWin 使用 RSA 密钥通过 SSH 连接;ssh.exe 无法创建 /home/user/.ssh

我正在使用 Win XP,并尝试使用 RSA 密钥通过 SSH 连接到远程主机。

我已经调查过 cygWin 识别文档和设置dir 作为主目录

Z:\app\cwRsync\bin>cygpath -H
/cygdrive/c/Documents and Settings

我已经在文件和设置/用户/.ssh并搬家了已知主机id_rsaid_rsa.pub那里。

现在,我正尝试通过 ssh.exe 连接到远程主机

Z:\app\cwRsync\bin>ssh -p 22 [email protected]
Could not create directory '/home/user/.ssh'.
The authenticity of host '[remotehost.com]:22 ([remotehost.com]:22)' can't be established.
RSA key fingerprint is f7:f4:2c:e0:c6:7e:d2:a4:45:70:63:df:bf:f2:84:46.
Are you sure you want to continue connecting (yes/no)?

我做错了什么?为什么 ssh.exe 无法创建目录 /home/user/.ssh?

谢谢。

答案1

尝试将 .ssh 上的权限更改为 700。这是因为 .ssh 是存储私钥的敏感目录。

另一个可以尝试的方法是ln -s /cygdrive/c/Documents\ and\ Settings /home,从而导致 /home 中的搜索重定向到 Documents and Settings。

答案2

天哪……我也在这上面浪费了好几个小时……

对我来说,解决方案是:设置一个名为 HOME 的 Windows 用户环境变量,指向 %USERPROFILE%

显然(黑盒视图)这允许 cygwin $HOME 环境变量干净地解析为 %USERPROFILE% windows 变量,并且一切都会顺利解决。这还将为用户配置文件保留所有 Windows 安全性,这使它成为我见过的最佳解决方案(...我最近见过其中几个!)

建议见以下网址: http://hrivera99.blogspot.com.au/2013/09/openssh-failed-to-add-hosts-to-list-of.html

希望这可以为其他人节省几个小时的时间!

答案3

在本地计算机的 Documents and Settings 文件夹中,创建文件夹home\<user>。出于某种原因,cwRsync 不会为您创建这些文件夹。我没有更改我的 cygpath,因此我在中创建了我的 cygpath C:\Program Files\cwRsync\home\<user>

答案4

无法创建,因为已经创建了。我怀疑是权限问题。 以及 中的文件的权限~~/.ssh什么~/.ssh

相关内容