Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两台服务器,名为:“eps”和“dev”。在服务器开发上,我已将 eps 的公钥添加到 authorized_keys 文件中。然后我在开发服务器上重新启动了 SSH 服务,以确保它获取我添加到 authorized_keys 文件中的新公钥。
但是,当我尝试从“eps”通过 ssh 进入“dev”时,系统会提示我输入密钥密码。确切的提示是:输入密钥“/home/webmaster/.ssh/id_rsa”的密码:
为什么会这样?我认为它应该立即让我登录到开发服务器。
使用 ssh-keygen 创建 SSH 密钥时,系统会提示您输入密码以保护私钥。因此,要让 SSH 使用密钥,必须输入密码才能在本地解锁私钥,这就是您看到“输入密钥密码”的原因。这与在 SSH 服务器上验证用户的密码不同。
为了获得无密码登录,您需要使用 ssh-keygen 创建一个密码为空的密钥文件。