------------------------------------------------ For Super Users, ssh password-free logon ------------------------------------
Environment Introduction:
HOST 1: IP 192.168.200.142
Host 2: IP 192.168.200.158
User Requirements: Password-free logon is required for both the host and the host.
Command: ssh scp, installation package: OpenSSH-clients
Password-free process:
1,Ssh-keygen-t rsa (Operation on Host 1)
[[Email protected] ~] # Ssh-keygen-T RSA
Generating public/private RSA key pair.
Enter file in which to save the key (/root/. Ssh/id_rsa ):
Created directory '/root/. Ssh '.
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:
70: 58: 3f: 09: 6d: BB: 2C: Ea: F9: 78: 2b: 05: 7A: 92: 1D: 3D [email protected]
The key's randomart image is:
+ -- [RSA 2048] ---- +
| O. |
| O oo. |
| O... +. |
| OOE... |
| + Oso. |
| + O |
| O. |
| Oo. |
|. ++ O. |
+ ----------------- +
2. Ssh-copy-ID-I ~ /. Ssh/id_rsa.pub 192.168.200.158(Operation on Host 1)
[[Email protected] ~] # Ssh-copy-ID-I ~ /. Ssh/id_rsa.pub 192.168.200.158
The authenticity of host' 192. 168.200.158 (192.168.200.158) 'can't be established.
RSA key fingerprint is F0: 4C: 31: B9: A6: 3C: BC: D8: 9B: 05: 77: 62: 22: 9B: 7e: 0a.
Are you sure you want to continue connecting (Yes/No )? Yes
Warning: Permanently added '192. 168.200.158 '(RSA) to the list of known hosts.
[Email protected]'s password:
Now try logging into the machine, with "ssh '192. 168.200.158 '", and check in:
. Ssh/authorized_keys
To make sure we haven't added extra keys that you weren't expecting.
3. Ssh 192.168.200.158(Operation on Host 1)
SSH 192.168.200.158
Last login: Sat Oct 27 05:34:11 2018 from 192.168.200.1
Pay special attention to permission issues:
-------------------------------------- HOST 1 -------------------------------------------------------
---------------------------------- Host 2 -------------------------------------------------------------------------
SSH password-free remote login (1)