In ubuntu, SSH has no password configuration, and hadoop nodes do not have a password to log on.

Source: Internet
Author: User

Today, when we set up the hadoop environment configuration, We need to log on via SSH without a password. It took a lot of effort and finally got it done.

First, different Linux operating systems may have slightly different commands. my operating system is Ubuntu, So I recorded what I did.

1. hadoop02 @ ubuntuserver2:/root $ ssh-keygen-t rsa command. When the result is displayed, I press enter until the end,

Generating public/private RSA key pair. <br/> enter file in which to save the key (/home/hadoop02 /. SSH/id_rsa): <br/> enter passphrase (empty for no passphrase): <br/> enter same passphrase again: <br/> your identification has been saved in/home/hadoop02 /. SSH/id_rsa. <br/> your public key has been saved in/home/hadoop02 /. SSH/id_rsa.pub. <br/> the key fingerprint is: <br/> 0f: 7e: 45: 6C: 40: 7c: 9d: 46: C5: 12: 31: 09: 5C: 2c: 4A: AA hadoop02 @ brief tuserver2 <br/> the key's randomart image is: <br/> + -- [RSA 2048] ---- + <br/> | Oo .. ** B. | <br/> | OO + B .. | <br/> | O + O. | <br/> | .. o | <br/> |. s. | <br/> | E. o. | <br/> |. o | <br/> |. | <br/> + --------------- + <br/>

2. hadoop02 @ ubuntuserver2:/root $ cat. Ssh/id_rsa.pub>. Ssh/authorized_keys
Note: there is a space between Cat and. Ssh, and between id_rsa.pub and>.

3. hadoop02 @ ubuntuserver2 :~ $ Cd. SSH

4. hadoop02 @ ubuntuserver2 :~ $ LS-

Authorized_keys id_rsa id_rsa.pub

5. hadoop02 @ ubuntuserver2 :~ /. Ssh $ SSH localhost to check whether there is no password to log on
6. Copy id_rsa.pub in hadoop02 to hadoop01.

Hadoop02 @ ubuntuserver2 :~ /. Ssh $ SCP id_rsa.pub hadoop01@192.168.1.135:/home/hadoop01
Note: The hadoop01@192.168.1.135 must be written like this in the Ubuntu operating system, otherwise an error will occur. This may be different from other Linux operating systems. hadoop01 is your login name, And 192.168.1.135 is an IP address.

In this way, the transfer is successful!

7. hadoop01 @ hadoop-MASTER :~ $ Cat id_rsa.pub>. Ssh/authorized_keys

Note that this is in the/hadoop01 directory. After this is completed, hadoop02 does not need a password to access hadoop01.

8, test: In hadoop02, ssh hadoop01@192.168.1.135 test can control hadoop01 directly!

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.