Configure SSH-free login between multiple hosts in Linux

Source: Internet
Author: User
Tags free ssh

1. Install SSH. sudo apt-get install SSH. When the installation is complete, a hidden folder is generated in the ~ directory (the current user home directory, which is/home/xuhui here). SSH (Ls-a can view hidden files). If you do not have this file, you can create a new one (mkdir. ssh).

2. Enter the. SSH directory below, execute on each machine: ssh-keygen-t RSA followed by a return, generating a key;

3. After completing the second step, two files are generated:

Id-rsa #私钥
Id-rsa.pub #公钥
4. In the directory of the first machine. Execute commands under SSH, cat id-rsa.pub >> Authorized_keys; After that, the Authorized_keys file appears under SSH.

5. Then copy the Authorized_keys file under the. SSH directory of the first machine to the. SSH directory of the second computer, such as: SCP Authorized_keys [Email protected]:~/.ssh/

6. Next to the. SSH directory of the second machine, you will find the file-authorized_keys just transferred, and then execute the command to add the second computer's public key, such as: Cat Id-rsa.pub >> Authorized_keys.

7. Transfer the newly generated authorized_keys of the second computer to the third computer and add the public key-id-rsa.pub of the third computer to the Authorized_keys passed from the second computer.

8. And so on, until the last computer.

9. After the last computer finishes adding, the generated Authorized_keys file contains the public key of all computers and can be added directly to the file-authorized_keys if there are additional machines in the future. Finally, copy the last generated Authorized_keys to the. SSH directory of each computer, overwriting the previous authorized_keys.

10. After sinking the nineth step, you can login to other computations on any computer, password-free ssh.

Notes note the following two files (clips) have permission settings to make sure that they are correct.

chmod ~/.ssh

chmod ~/.ssh/authorized_keys

Reference: https://www.cnblogs.com/hrx-star/p/5795765.html

Configure SSH-free login between multiple hosts in Linux

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.