First, SSH password-free login principle
This is done to build Hadoop cluster operations
Master (namenode| Jobtracker) as a client, to implement password-free public key authentication, connect to the server salve (datanode| Tasktracker), you need to generate a key pair (public and private) on master, and when Master connects to slave via SSH, Slave generates a random number and encrypts the random number with the master's public key. Sent to Master.master received encrypted value and then decrypted with the private key, and the decrypted data back to Slave,slave to confirm the decryption data is correct after allowing master to connect, this is the public key authentication process, the period does not need to manually enter the password, It is important to copy the client master to the slave
Ii. Pre-Preparation 1. Install a master server and a Slave server
172.128.120.0 |
Localhost.hadoop |
172.128.120.1 |
Localhost.slave1 |
2. Configuring the Hosts File
Third, configure the master-free login slave11, on the master machine into a key pair, the file is saved by default in the/home/hadoop/.ssh folder
2, according to the configuration in Sshd_config, the public key file is appended to the authorized key to
3. View/etc/ssh/sshd_config File
4, modify the permissions of the Authorized_keys file, because the rights are incorrect, you can not use the RSA function
chmod ~/.ssh/suthorized_keys
5, verify whether you can use no password to log on to the machine
6. Copy the public key on master to the slave1 machine
7. The SLAVE1 machine appends the public key copied on master to the Authorized_keys file and changes the file permissions, as well as modifying the Sshd_config configuration file
8, verify master no secret login slave
Iv. configuration slave1 Password-free login master1, slave1 on the generated secret key
2. Append key and Modify permissions on Slave1
3. Copy the public key on the slave1 to master
4. Append the slave1 public key to the key file on the master server
5. View Aster's Authorized_key file to see Slave1 's public key added to it.
6, verify slave1 can not connect master
Linux Series configuration password-free login