Linux Server ssh password-free login

Source: Internet
Author: User
Tags ssh access

Assume that there are three servers with IP 10.9.1.101, 10.9.1.102, 10.9.1.103, respectively.

    1. 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

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.