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"