Ssh添加和联系服务器失败

我忘了如何做这个程序。

我在OSX 10.9.1上做过

  • 在我的服务器上运行ssh-keygen
  • 移动私钥id_rsa到我的笔记本电脑的$HOME/.ssh/id_rsa ,从我的服务器中删除私钥id_rsa
  • 在我的笔记本电脑中创build以下$HOME/.ssh/config
  • 运行ssh-add $HOME/.ssh/id_rsa

我的.ssh / config

 Host server.myhomepage.com User masi Port 22 Hostname server.myhomepage.com IdentityFile ~/.ssh/id_rsa TCPKeepAlive yes IdentitiesOnly yes 

我跑

 ssh-add .ssh/id_rsa Enter passphrase for .ssh/id_rsa: Identity added: .ssh/id_rsa (.ssh/id_rsa) 

并运行更多

 ssh server.myhomepage.com Saving password to keychain failed 

它在我给出的graphics窗口中询问了我的密码id_rsa,但是得到了失败的信息。 然后,它在terminal询问我是否正确input了我的私钥的密码,但仍然显示失败的消息。 我用正确的密码运行了很多次

 Identity added: /Users/masi/.ssh/id_rsa (/Users/masi/.ssh/id_rsa) [email protected]'s password: Permission denied, please try again. 

我忘了如何正确地做这个程序。 你怎么能正确的钥匙链钥匙?

在客户端,您需要私钥和公钥部分。

在服务器端,您需要在$HOME/.ssh/authorized_keys具有公钥部分的密钥。

因此,描述中缺less的步骤是:

  • 将公钥复制到笔记本电脑的$HOME/.ssh/id_rsa.pub
  • 将公钥添加到服务器的$HOME/.ssh/authorized_keys

我会猜测你和小牛在OSX上。 这个苹果支持论坛的消息似乎非常相关:

https://discussions.apple.com/thread/5470737?btstart=0

看起来你需要将由ssh-keygen生成的密钥“按”到OSX补丁openssh可以使用的表单中。

可能的情况可能是这种情况:

https://apple.stackexchange.com/questions/106364/osx-ssh-agent-no-password-pasting-and-problem-with-pkcs8

如果继续有问题,请添加私钥的前三行,如下所示:

  -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,3EA2BF123CB9E67FBB094A12A82E7BAF 

顺便说一句,我会很高兴知道你是否有一个名为SSH_ASKPASS的环境variables。 那在理论上应该是苹果ssh-add如何调用graphics密码提示。

祝你好运!