Assume that there are three servers with IP 10.9.1.101, 10.9.1.102, 10.9.1.103, respectively.
- Modify the Hosts file
Modify the Hosts file (vi/etc/hosts) for each of the three servers, respectively,
Added in the Hosts file
10.9.1.101 node101
10.9.1.102 node102
10.9.1.103 node103
2. Generate the public and private keys on the 101 machine
SSH-KEYGEN-T RSA
- Enter will prompt for the public and private key storage location, directly enter the default is in the home directory
- Prompt for password and Confirm password, in order to SSH access process without password directly enter
3. Copy the generated id_rsa.pub file from 101 to the same directory in 102
Because of the Hadoop users I used on 101, the generated file directory is also used in the/home/hadoop directory, on 102, with Hadoop user operations
Copy the/home/hadoop/id_rsa.put file on 101 to the/home/hadoop directory of 102
4. Create the. SSH directory on 102
- Check that the/home/hadoop directory on 102 exists. SSH folder (ls not displayed, direct CD. SSH), if not present, create the. SSH directory and set the permissions to the (mkdir-m=700.ssh)
- Copy the Id_rsa.pub file to the Authorized_keys file in the. SSH directory (cp id_rsa.pub. Ssh/authorized_keys)
- The permission to set the Authorized_keys file is 664 (chmod 644. Ssh/authorized_keys)
5.ssh Access
SSH node102
(I configured the 103)
6. Multiple machine deployments
This procedure only configures 101 to 103 password-free login, if you also need to configure 102 to 103 password-free login, only need to repeat step 102 on the 2 machine, and then append the contents of the generated id_rsa.pub file to the end of the 103 Authorized_keys file.
Linux Server ssh password-free login