Linux SSH password-free login configuration

Source: Internet
Author: User

Linux SSH password-free login configuration because of learning hadoop, SSH password-less login is required between clusters, so before installing hadoop, you must configure password-less SSH Login between machines. How do I Configure SSH login without a password? The following example shows how to log on to machine B without A password on machine A: 1. Switch to the user you want to log on to, for example, we use the user named hadoop of machine A to log on to the hadoop user of machine B. Www.2cto.com su hadoop switches to hadoop users. 2. Change the Host Name of the two machines. Here, A: master B: slave1: Modify the host name in the file "etc/sysconfig/network. NETWORKING = yes HOSTNAME = Remember to restart the host name !!! And modify the hosts ing: vi/etc/hosts www.2cto.com Java code 192.168.1.60 master 192.168.1.61 slave1 192.168.1.62 slave2 write the corresponding IP address and host name 2, A machine: Generate rsa public key: ssh-keygen-t rsa-f ~ /. Ssh/id_rsa //-t encryption type-f key file storage path, if: Java code [hadoop @ master ~] $ Ssh-keygen-t rsa-f ~ /. Ssh/id_rsa Generating public/private rsa key pair. created directory '/home/hadoop /. ssh '. enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in/home/hadoop /. ssh/id_rsa. your public key has been saved in/home/hadoop /. ssh/id_rsa.pub. the key fingerprint is: e9: AB: f0: 48: af: 2d: d4: 98: 59: 68: bc: 3d: 52: 3e: 94: bc hadoop @ master The key's randomart im Age is: + -- [RSA 2048] ---- + |. o. | + *. |. %. S | B E. |. o. o. | .. *. | oo = .. | + --------------- + [hadoop @ master ~] $ Cd. ssh also performs the second operation on machine B. 3. Set machine A/home/hadoop /. the id_rsa.pub under ssh/is transmitted to the/home/hadoop /. ssh/and rename it as master Java code [hadoop @ master. ssh] $ scp id_rsa.pub hadoop @ slave1:/home/hadoop /. ssh/master hadoop @ slave1's password: id_rsa.pub 100% 395 0.4KB/s 4. Switch to the B server, log on to the hadoop user, and append the uploaded master to the file named authorized_keys, if cat master> authorized_keys does not exist, permissions are automatically created. 5. modify the permissions of authorized_keys and id_rsa.pub to 644 Java code [hadoop @ slave1. ssh] $ Chmod 644 id_rsa.pub [hadoop @ slave1. ssh] $ chmod 644 authorized_keys at this time, the SSH password-free login configuration is successfully tested. At this time, run the Java code [hadoop @ master. ssh] $ ssh slave1 Last login: Mon Mar 4 22:23:06 2013 from master [hadoop @ slave1 ~] $ No password is prompted. The configuration is successful at www.2cto.com.

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.