Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 -
IP of System2 -

[A1@System1 ~]$ssh-keygen -t dsa       - Generated succesfully
[A2@System2 ~]$ssh-keygen -t dsa       - Generated succesfully
[A1@System1 ~]$scp -p .ssh/ A2@  - Successfully Uploaded
[A2@System2 ~]$chmod 600 .ssh/authorized_keys2
[A1@System1 ~]$ssh A2@   - 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/ A2@  - Successfully Uploaded
[A2@System2 ~]$chmod 600 .ssh/authorized_keys5
[B1@System1 ~]$ssh A2@      - 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

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


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.