无法使用身份验证密钥对远程系统执行 ssh(不询问密码)

1 linux ssh ssh-keys

你好朋友。

                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 A2@200.0.0.2:.ssh/authorized_keys2  - Successfully Uploaded
[A2@System2 ~]$chmod 600 .ssh/authorized_keys2
[A1@System1 ~]$ssh A2@200.0.0.2   - Logined successfully without asking any password Done.
Run Code Online (Sandbox Code Playgroud)

现在我希望 System1 的用户 B1 也应该能够以相同的方式对 System2 的 A2 用户执行 ssh。我没有对 System2 的 A2 用户进行任何更改。

[B1@System1 ~]$ssh-keygen -t dsa       - Generated succesfully
[B1@System1 ~]$scp -p .ssh/id_dsa.pub A2@200.0.0.2:.ssh/authorized_keys5  - Successfully Uploaded
[A2@System2 ~]$chmod 600 .ssh/authorized_keys5
[B1@System1 ~]$ssh A2@200.0.0.2      - Now it is asking Passowrd for A2 user of System2. This is problem
Run Code Online (Sandbox Code Playgroud)

当我尝试从 B1@System1 到 A2@System2 执行 ssh 时,为什么它会询问密码。我已经完成了相同的步骤,差距在哪里。仍然可以在不询问密码的情况下从 A1@System1 到 A2@System2 执行 ssh。

请建议我并指出我错的地方

m0n*_*sar 5

使用 ssh-copy-id 命令代替 scp,它将在正确的位置设置正确的文件并具有正确的权限以启用无密码登录