Implement password-free access between two (multiple) servers

Source: Internet
Author: User

1. log on to any server

Ssh 192.168.21.90

2. Execute the command

Ssh-keygen-t rsa

Java code
[Root @ fedora14ip90 ~] # Ssh-keygen-t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/. ssh/id_rsa): twoServer
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in twoServer.
Your public key has been saved in twoServer. pub.
The key fingerprint is:
6e: 0c: 30: 81: 93: 81: d3: 53: 0b: 77: 88: 8d: 53: 5a: 5a: 6d root @ fedora14ip90
The key's randomart image is:
+ -- [RSA 2048] ---- +
| OoXBo. |
| O XBo + E |
|. O ++. |
| O |
|. S |
| + |
| + |
|. |
|
+ ----------------- +
[Root @ fedora14ip90 ~] #


In this process, enter the file name [at will] And the password [at will].

3. Go to the key folder

Reference
[Root @ fedora14ip90. ssh] # cd/root/. ssh/


4. Copy the key to a computer that requires no password for access. Just run the scp command.

Java code
Root@192.168.21.91:/root/scp id_rsa.pub/


Scp [file] [User Name of the computer without a password (I am root here)] @ [ip address of the computer without a password, needless to say]: [target folder of the computer without a password]
Enter the password.

5. log on to the computer that requires password-free access and execute the command.
Cat/root/id_rsa.pub> ~ /. Ssh/authorized_keys

6 successful


Appendix:
If you need to quickly implement the above steps, you do not need A password when logging on to machine B through ssh on machine.
1. Enter the command on machine
Ssh-keygen-t rsa-p ''~ /. Ssh/id_rsa
2. Generate the file ~ /. Ssh/id_rsa.pub copy to the machine B, and then perform the corresponding operations ~ /. Ssh/id_rsa.pub file content appended ~ /. Ssh/authorized_keys

Author "tsaowe"
 

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.