Configure SSH without password login (ready for Hadoop distributed Deployment)

Source: Internet
Author: User

SSH No Password principle Introduction:
First, a key pair is generated on the HADOOP1, including a public key and a private key, and the public key is copied to all slave (HADOOP2-HADOOP4).
Then when Master connects slave via SSH, Slave generates a random number and encrypts the random number with the master's public key and sends it to master.
Finally, master receives the encryption number and then decrypts it with the private key, and passes the decryption number back to slave, slave confirms that the decryption number is correct and allows master to connect without entering the password.

2, specific steps (in the case of root user and Hadoop user login)
1, execute the command ssh-keygen-t RSA and then all the way back to view the no key pair that was just generated: CD. SSH after execution ll
2, add the id_rsa.pub to the authorized key inside. Execute command Cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
3. Modify permissions: Execute chmod ~/.ssh/authorized_keys
4. Ensure that the following contents exist in Cat/etc/ssh/sshd_config

Rsaauthentication Yes
Pubkeyauthentication Yes
Authorizedkeysfile. Ssh/authorized_keys
To modify, execute the Restart SSH Service command after modification to make it effective: service sshd restart

5. Copy the public key to all slave machines: SCP ~/.ssh/id_rsa.pub 192.168.1.203: ~/then enter Yes, and finally enter the password for the slave machine
6. Create the. ssh folder on the slave machine: mkdir ~/.ssh then execute chmod ~/.ssh (if the folder exists then you do not need to create it)
7. Append to authorization file Authorized_keys Execute command: Cat ~/id_rsa.pub >> ~/.ssh/authorized_keys then execute chmod ~/.ssh/authorized_keys
8, repeat the 4th step
9. Authentication command: Execute SSH 192.168.1.203 on master machine to discover hostname changed from HADOOP1 to Hadoop3, then delete id_rsa.pub file: Rm-r id_rsa.pub
Follow the steps above to configure HADOOP1,HADOOP2,HADOOP3,HADOOP4 separately, requiring each to login without a password

Configure SSH without password login (ready for Hadoop distributed Deployment)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.