Assume that machine A is connected to machine B.
1. On Machine A, generate an RSA key pair
ssh-keygen -t rsa
Passphrase does not enter the password during this period. By default, files are generated ~ /. Ssh/
-RW ------- 1 WebAdmin 1675 October 17 12:09 id_rsa-rw-r -- r -- 1 WebAdmin 405 October 17 12:09 id_rsa.pub
2. Copy the content of id_rsa.pub and append it to the ~ of machine B ~ /. Ssh/authorized_keys file. You can manually copy the file or perform the following remote operations:
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]10.10.10.123
3. Check/etc/ssh/sshd_config on machine B. Make sure the following configurations are valid:
RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keys
4. Check ~ /. Ssh/authorized_keys permission, which must be 600. In fact, the permissions of group and others must be 0. If not, run
chmod 600 ~/.ssh/authorized_keys
5. If sshd_config is modified, restart the service:
service sshd restart
6. Test automatic SSH Login
ssh [email protected]10.10.10.123
If the configuration is successful, you do not need to enter the password.
SSH configuration Automatic Login