Environment:
Master
192.168.38.45
Slave
192.168.38.58
192.168.38.60
First, configure a one-way, master-to-slave-free key ssh login.
One-way configuration:
1. On master and all slave, use the yourname user name to execute:
Copy Code code example:
Ssh-keygen-t dsa-p '-F/HOME/YOURNAME/.SSH/ID_DSA
2. Under Master's/home/yourname/.ssh directory, execute:
Copy Code code example:
Cat id_dsa.pub > Authorized_keys
3. Copy the Authorized_keys on master to the same directory for all slave. Command:
Copy Code code example:
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
At this point, you can master to slaves one-way key-free login.
If you intend to loop the two-way landing then see the steps below.
Bidirectional:
1, on Master and all Slave, execute with yourname username:
Copy Code code example:
Ssh-keygen-t dsa-p '-F/HOME/YOURNAME/.SSH/ID_DSA
2, under the/home/yourname/.ssh directory of Master, execute:
Copy Code code example:
Cat id_dsa.pub > Authorized_keys
3, copy the Authorized_keys on master to the same directory of a Slave. Command:
Copy Code code example:
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
4, add 58 information to Authorized_keys:
Copy Code code example:
Cat Id_dsa.pub >> Authorized_keys
5, copy the Authorized_keys on 58 to 60 and add the Authorized_keys:
Copy Code code example:
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Cat Id_dsa.pub >> Authorized_keys
6, at this time Authorized_keys has all the machine's id_dsa.pub, then put him SCP to other nodes can:
Copy Code code example:
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
This can be bidirectional.
Note: All node id_dsa.pub must be added to Authorized_keys, so what if a node is added to the cluster? Add in and then all the SCP is distributed.
Please confirm the following questions:
The corresponding authorizedkeysfile in 1,/etc/ssh/sshd_config
The. Ssh/authorized_keys is configured
2, if not configured, you need to configure, and then restart:/etc/rc.d/init.d/sshd restart
3, Permissions issues
Linux free key SSH login Configuration tutorial Detailed