1. Host A uses ssh-keygen -t rsa to generate a public key. The public key is in the .ssh folder (cd ~/.ssh) under the current user’s home folder. id_rsa.pub file
2. Execute echo "A's public key" >>authorized_keys in the .ssh file under the corresponding user's home folder on host B, if there is no such file Then create a new one with the address: ~/.ssh/authorized_keys
3. Set the permissions of the public key file and authorized_keys file to 600 (more relaxed permissions are also available, such as 744)
4. A can log in to B without a password.
Special note: The permissions of the authorized_keys file must be 600, otherwise the addition of trust will fail, and machine A cannot directly log in to machine B without a password.
The above is the detailed content of Linux implements password-free login function. For more information, please follow other related articles on the PHP Chinese website!