Linux Dual-Machine Trust

Source: Internet
Author: User

Environment:

192.168.75.128 redhat6.5 x86_64

192.168.75.130 redhat6.5 x86_64


First, operate on the 192.168.75.130

1, the public key and the private key pair are generated under the ~/.ssh directory.

# Ssh-keygen

Generating public/private RSA key pair.

Enter file in which to save the key (/ROOT/.SSH/ID_RSA):

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/root/.ssh/id_rsa.

Your public key has been saved in/root/.ssh/id_rsa.pub.

The key fingerprint is:

E4:BB:24:9C:F9:01:A8:80:4D:DB:66:5B:47:48:C5:CA [email protected]

The key ' s Randomart image is:

+--[RSA 2048]----+

|        . O. |

| .        .. |

|  . ... o |

|. o O. e+ |

|o o = o S |

| .       + + = . |

| . . = +        |

| + O |

| o |

+-----------------+


2. Ssh-copy-id appends the contents of the public key id_rsa.pub to the ~/of the remote machine. Ssh/authorized_key. File

# ssh-copy-id-i ~/.ssh/id_rsa.pub 192.168.75.128

[email protected] ' s password:

Now try logging to the machine, with "ssh ' 192.168.75.128 '", and check in:


. Ssh/authorized_keys


To make sure we haven ' t added extra keys so you weren ' t expecting.


3, log on to the remote machine does not enter the password, after landing will be the other party's information, recorded in the Known_hosts file, the first login need to enter Yes

# SSH 192.168.75.128

# SSH Slave.localdomain #如果需要主机名登陆, also need to log in early, because the first login need to enter Yes


4. No password required to log on to the machine


# ssh-copy-id-i ~/.ssh/id_rsa.pub 192.168.75.130

# SSH 192.168.75.130

# SSH Mater.localdomain



Second, do the same operation on the 192.168.75.128

1, the public key and the private key pair are generated under the ~/.ssh directory.

# Ssh-keygen

Generating public/private RSA key pair.

Enter file in which to save the key (/ROOT/.SSH/ID_RSA):

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/root/.ssh/id_rsa.

Your public key has been saved in/root/.ssh/id_rsa.pub.

The key fingerprint is:

E4:BB:24:9C:F9:01:A8:80:4D:DB:66:5B:47:48:C5:CA [email protected]

The key ' s Randomart image is:

+--[RSA 2048]----+

|        . O. |

| .        .. |

|  . ... o |

|. o O. e+ |

|o o = o S |

| .       + + = . |

| . . = +        |

| + O |

| o |

+-----------------+


2. Ssh-copy-id appends the contents of the public key id_rsa.pub to the ~/of the remote machine. Ssh/authorized_key. File

# ssh-copy-id-i ~/.ssh/id_rsa.pub 192.168.75.130

[email protected] ' s password:

Now try logging to the machine, with "ssh ' 192.168.75.130 '", and check in:


. Ssh/authorized_keys


To make sure we haven ' t added extra keys so you weren ' t expecting.


3, log on to the remote machine does not enter the password, after landing will be the other party's information, recorded in the Known_hosts file, the first login need to enter Yes

# SSH 192.168.75.130

# SSH Master.localdomain #如果需要主机名登陆, also need to log in early, because the first login need to enter Yes


4, the landing of the machine does not require a password, if there is a login host name,


# ssh-copy-id-i ~/.ssh/id_rsa.pub 192.168.75.128

# SSH 192.168.75.128

# SSH Slave.localdomain


Reference: http://blog.chinaunix.net/uid-26284395-id-2949145.html


This article from the "Small Fish Blog" blog, reproduced please contact the author!

Linux Dual-Machine Trust

Related Article

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.