无法使用身份validation密钥执行ssh(不询问passowrd)到远程系统

你好朋友。

I am using Rhel 5.4 on System1 and centos 5.4 on System2. I am able to do SSH from A1 user of System1 to A2 User of System2 by simple method.Now i want that i generates Keys for both user A1 & A2. I generated keys succesfully. IP of System1 - 200.0.0.1 IP of System2 - 200.0.0.2 [A1@System1 ~]$ssh-keygen -t dsa - Generated succesfully [A2@System2 ~]$ssh-keygen -t dsa - Generated succesfully [A1@System1 ~]$scp -p .ssh/id_dsa.pub [email protected]:.ssh/authorized_keys2 - Successfully Uploaded [A2@System2 ~]$chmod 600 .ssh/authorized_keys2 [A1@System1 ~]$ssh [email protected] - Logined successfully without asking any password Done. 

现在我想System1的用户B1也应该能够以同样的方式对System2的A2用户执行ssh。我对System2的A2用户没有做任何改变。

 [B1@System1 ~]$ssh-keygen -t dsa - Generated succesfully [B1@System1 ~]$scp -p .ssh/id_dsa.pub [email protected]:.ssh/authorized_keys5 - Successfully Uploaded [A2@System2 ~]$chmod 600 .ssh/authorized_keys5 [B1@System1 ~]$ssh [email protected] - Now it is asking Passowrd for A2 user of System2. This is problem 

当我试图从B1 @ System1执行ssh到A2 @ System2时,为什么它要求input密码。 我做了同样的步骤,差距在哪里。 Stiil,我可以从A1 @ System1到A2 @ System2做ssh,而不需要询问密码。

请build议我并指出我错在哪里

使用ssh-copy-id命令而不是scp,它会使用正确的权限在正确的位置设置正确的文件以启用无密码login

您不能只为authorized_keys文件使用任何名称。 在SSH v2中不build议使用authorized_keys2。

只需要为这两个帐户使用一个文件并添加第二个公钥即可。 不要覆盖文件,你应该能够从两个不同的帐户/机器ssh到同一个帐户。