Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hello Friends.

                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.

Now I want that User B1 of System1 should also be able to do ssh by same manner to A2 user of System2.I am not doing any changes in A2 user of System2.

[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

Why it is asking password when i am trying to do ssh from B1@System1 to A2@System2. I have done same steps where is the gap. Stiil i am able to do ssh from A1@System1 to A2@System2 without asking password.

Kindly suggest me and point out where i am wrong

share|improve this question

2 Answers 2

use ssh-copy-id command instead of scp, it will set the correct files at the correct places with the correct permissions to enable passwordless login

share|improve this answer

You can not just use any name for the authorized_keys file. The use of authorized_keys2 is deprecated in SSH v2.

Just use one file for both accounts and append the public key of the 2nd. Don't overwrite the file and you should be able to ssh from two different accounts/machines to the same account.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.