解决Enter passphrase for key

2022-10-04 08:16:36

两种解决方案:

1.提示“ Permissions 0644 for ‘~/.ssh/id_rsa.pub’ are too open”

解决方法:使用chmod 0600 ~/.ssh/id_rsa.pub更改将公钥权限改成“600”

2.提示“Enter passphrase for key ~/.ssh/id_rsa.pub”让输入私钥,可不论输与不输都不能直接登录

解决方法:
在本地执行:

eval `ssh-agent` 
ssh-add

ssh-agent是用于管理密钥,ssh-add用于将密钥加入到ssh-agent中,SSH可以和ssh-agent通信获取密钥,这样就不需要用户手工输入密码了。
顺序执行以上两条命令后就可以用ssh免密登录远程机器了,但这个配置只对当前会话生效,会话关闭或机器重启后都需要重新执行这两条命令。将命令放到~/.bash_profile中,就可以免去每次输入的麻烦。

转载地址:https://blog.csdn.net/superbfly/article/details/75287741

保存密码

ssh-add -K path/to/key,然后输入密码,之后就不用次次输入密码了;

macOS keeps asking my ssh passphrase since I updated to Sierra

In the latest version of macOS (10.12.2), this is easy to fix. Just edit your ~/.ssh/config and enable the UseKeychain option:

Host *
    UseKeychain yes

There is no need to change anything else. Now everything works the way it used to work before the latest updates. You do not need to add keys to ssh-agent.
转载地址:https://superuser.com/questions/1127067/macos-keeps-asking-my-ssh-passphrase-since-i-updated-to-sierra

  • 作者:alexander_phper
  • 原文链接:https://blog.csdn.net/alexander_phper/article/details/80185160
    更新时间:2022-10-04 08:16:36