简体   繁体   English

ssh 使用没有密码的私钥

[英]ssh using private-key without password

I have two servers A and B , i am trying to ssh from A to B using private-key and i don't want to provide password of server B.我有两台服务器 A 和 B,我试图使用私钥从 A ssh 到 B,我不想提供服务器 B 的密码。

I am trying below command for ssh ::我正在尝试以下命令用于 ssh ::

ssh -i <generated_private_key>  <user>@<host name>

the private-key is perfectly fine.私钥完全没问题。 but still this command asking for password.但仍然是这个命令要求输入密码。

In order to use ssh passwordless connection you need to place the contents of ~/.ssh/id_rsa.pub (id_rsa.pub is just an example could be anything you used durring generation) of the user@local_machine to the ~/.ssh/authorized_keys of the some_user@remote_machine.为了使用 ssh 无密码连接,您需要将 user@local_machine 的~/.ssh/id_rsa.pub (id_rsa.pub 只是一个例子,可以是您在生成期间使用的任何内容)的内容放置到~/.ssh/authorized_keys some_user@remote_machine 的~/.ssh/authorized_keys Further if other issues exist then you should check /var/log/ for the error.此外,如果存在其他问题,那么您应该检查/var/log/是否有错误。

Edit1: Based on comments (thanks to @Crazy) if you used passphrase durring creation of the key then you need to recreate the key without the passphrase. Edit1:根据评论(感谢@Crazy),如果您在创建密钥期间使用了密码,那么您需要重新创建没有密码的密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM