Reprint Please specify source: http://www.cnblogs.com/blazer/p/5165304.html
I. Overview
1. In order to allow two Linux machines to use SSH between the user name and password is not required. Digital signature RSA or DSA is used to complete this operation.
2. Model Analysis
Suppose a (192.168.20.59) is a client machine, B (192.168.20.60) is the target machine;
To achieve the purpose:
A machine SSH login B machine does not need to enter a password;
Encryption mode RSA|DSA can be selected, the default DSA
Second, the specific operation process
The operation process of one-way landing (can satisfy the above purpose):
1. Log In a machine
2, Ssh-keygen-t [RSA|DSA], will generate a key file and a private key file id_rsa,id_rsa.pub or id_dsa,id_dsa.pub
3. Copy the. pub file to the. SSH directory of the B machine, and cat id_dsa.pub >> ~/.ssh/authorized_keys
4, finished, from a machine login B machine's target account, no longer need password; (direct running #ssh 192.168.20.60 )
Two-way landing operation process:
1, Ssh-keygen do password authentication can make in to the other side of the machine ssh, SCP does not use the password. The method is as follows:
2, two nodes perform the operation:#ssh-keygen-t RSA
Then all returns, with default values.
3, this generates a pair of keys, stored in the user directory ~/.ssh.
test the public key into the user directory of the other machine and copy it to ~/.ssh/authorized_keys (Operation command:#cat id_dsa.pub >> ~/.ssh/authorized_keys ).
4. Set file and directory permissions:
Set Authorized_keys Permissions
$ chmod Authorized_keys
Set the. SSH directory permissions
$ chmod 700-r. SSH
Permissions to set/home/${user name}
$ chmod 700-r/home/${user name}
Linux ssh password-free login