Linux free key SSH login Configuration tutorial Detailed

Source: Internet
Author: User

Environment:
Master
192.168.38.45
Slave
192.168.38.58
192.168.38.60
First, configure a one-way, master-to-slave-free key ssh login.

One-way configuration:
1. On master and all slave, use the yourname user name to execute:

Copy Code code example:

Ssh-keygen-t dsa-p '-F/HOME/YOURNAME/.SSH/ID_DSA

2. Under Master's/home/yourname/.ssh directory, execute:

Copy Code code example:

Cat id_dsa.pub > Authorized_keys

3. Copy the Authorized_keys on master to the same directory for all slave. Command:

Copy Code code example:

Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/

At this point, you can master to slaves one-way key-free login.
If you intend to loop the two-way landing then see the steps below.

Bidirectional:
1, on Master and all Slave, execute with yourname username:

Copy Code code example:

Ssh-keygen-t dsa-p '-F/HOME/YOURNAME/.SSH/ID_DSA

2, under the/home/yourname/.ssh directory of Master, execute:

Copy Code code example:

Cat id_dsa.pub > Authorized_keys

3, copy the Authorized_keys on master to the same directory of a Slave. Command:

Copy Code code example:

Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/

4, add 58 information to Authorized_keys:

Copy Code code example:

Cat Id_dsa.pub >> Authorized_keys

5, copy the Authorized_keys on 58 to 60 and add the Authorized_keys:

Copy Code code example:

Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Cat Id_dsa.pub >> Authorized_keys

6, at this time Authorized_keys has all the machine's id_dsa.pub, then put him SCP to other nodes can:

Copy Code code example:

Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/
Scp/home/yourname/.ssh/authorized_keys [Email protected]:/home/yourname/.ssh/

This can be bidirectional.
Note: All node id_dsa.pub must be added to Authorized_keys, so what if a node is added to the cluster? Add in and then all the SCP is distributed.

Please confirm the following questions:
The corresponding authorizedkeysfile in 1,/etc/ssh/sshd_config
The. Ssh/authorized_keys is configured
2, if not configured, you need to configure, and then restart:/etc/rc.d/init.d/sshd restart
3, Permissions issues


Linux free key SSH login Configuration tutorial Detailed

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.