Linux cluster configuration SSH no password access

Source: Internet
Author: User

First, modify the host file

1) Connect to the Linux server with the client tool (SSH client or putty). Enter the command under root user

Vi/etc/hosts, edit the Hosts file with VI as follows:

#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4#::1         localhost Localhost.localdomain Localhost6 localhost6.localdomain6192.168.1.160 host01192.168.1.161 host02192.168.1.162 host03192.168.1.163 host04192.168.1.164 host05

2) Enter the command: CD. SSH into the directory where the RSA public key file is stored, delete the Id_rsa,id_rsa.pub file under the directory.

Second, generate a new RSA public key file on each machine and copy it to a Authorized_keys file uniformly.

1) Login host01, enter the command in the. SSH directory:

SSH-KEYGEN-T RSA

, three times after the return, the directory will generate id_rsa,id_rsa.pub these 2 files. Other hosts also use this method to generate the key file.

2) Login host01, enter the command:

CP id_rsa.pub authorized_keys         Copy Rename

(Cat id_rsa.pub >> authorized_keys) copy content

, rename the Id_rsa.pub public key copy to the Authorized_keys file.

3) Log in to other hosts and copy the contents of the other hosts ' public key files to the Authorized_keys file on the host01 host, as follows:

Ssh-copy-id-i host01 #登录host02, copy the public key to the Authorized_keys of host01 ssh-copy-id-i host01# login host03, copy the public key to host01 authorized _keys in ssh-copy-id-i host01# login host04, copy the public key to host01 Authorized_keys ssh-copy-id-i #登录host05, Copy the public key to the Authorized_keys of host01
Iii. Authorization of Authorized_keys documents

1) Login host01, enter the command in the. SSH directory:

chmod Authorized_keys

, the effect is as follows:

[email protected]. ssh]# ls-altotal 28drwx------.  2 root root 4096 Oct 12:27. Dr-xr-x---. Root root 4096 Oct 24 19:20. -RW-------.  1 root root 1975 Oct 12:27 AUTHORIZED_KEYS-RW-------.  1 root root 1975 Oct 12:09 AUTHORIZED_KEYS_20141024-RW-------.  1 root root 1675 Oct 12:23 id_rsa-rw-r--r--.  1 root root  395 Oct 12:23 id_rsa.pub-rw-r--r--.  1 root root 2020 Oct 12:10 known_hosts
Iv. assigning authorization files to other hosts

1) Log in to host01, copy the authorization file to host02, host03 ..., the command is as follows:

Scp/root/.ssh/authorized_keys host02:/root/.ssh/#拷贝到host02上scp/root/.ssh/authorized_keys host03:/root/.ssh/# Copy to host03 Scp/root/.ssh/authorized_keys host04:/root/.ssh/#拷贝到host04上scp/root/.ssh/authorized_keys host05:/root/ . ssh/#拷贝到host05上

2) At this point, password-free login has been set to complete, note that the first SSH login needs to enter a password, re-access can be password-free login.

Original address: http://www.cnblogs.com/ivan0626/p/4144277.html

Linux cluster configuration SSH no password access

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.