I'm using openSSH in RHEL 4. Just my exercise. But I found something weird about the behavior of the SSH. The circumstances: I have 2 computer: com1 and com2. Each computer has an user account (user1@com1 and user2@com2). I intend to make user1@com1 ssh to user2@com2 without prompting a password, so sharing public key is required.
- Method 1: using
Code:
scp user1@com1:.ssh/id_dsa.pub user2@com2:.ssh/authorized_keys
This one works perfectly.
- Method 2:
Code:
scp user1@com1:.ssh/id_dsa.pub user2@com2:.ssh/something.pub
then in com2:
Code:
cat .ssh/something.pub > .ssh/authorized_keys
This one doesn't work until I make one more
Code:
chmod 600 .ssh/authorized_keys
- Method 3: First steps are exactly those in method 2. Then I change to root account
. With the root, I
Code:
cat .ssh/something.pub > .ssh/authorized_keys
. This one works without having to "chmod"
So, the question is, what makes the differences between the methods ? Why do we need "chmod" to make the thing works ? ( I think the "chmod" here does not relate to permissions at all because I changed to the same permission ! )
PS: Excuse me if my English is so bad
.