An easy way to configure SSH password-free login between multiple computers in a cluster

Source: Internet
Author: User
Tags free ssh

When we are configuring multiple computations so that they can be used with each other without password login-ssh, before it is a single configuration, now add B on one a, and then add a on another B, so that the content in Authorized_keys is the same, but not exactly the same, such as the order of addition. If more than 2 units, this configuration is quite complex, and error-prone. Later, a simple configuration was seen on the web, and all the machines needed to be configured again.

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, theauthorized_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 in the cluster.

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

10. After sinking the nineth step, you can log on to any computer in the cluster, password-free SSH login to other calculations.

An easy way to configure SSH password-free login between multiple computers in a cluster

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.