Pre-preparation
- Server side needs to install and turn on SSH service
- Client side needs to support Ssh-keygen command
- Confirm that two machines can connect to the Internet
1. Detect if SSH installation is successful
ssh -V
If you do not successfully display version information, you will need to follow the platform for the installation of the relevant SSH.
2. Client side generates key pair
Execute on client side
- During execution, it asks you to confirm the location where the public key is saved (by default:. Ssh/id_rsa), then it will let you enter a password two times, if you do not want to enter the password when using the public key, you can leave blank, after execution, will generate a pair of keys on the data client side.
- Look at the client side of the user directory ~/.ssh, see if there is a pair of files named with Xxx_rsa and Xxx_rsa.pub, the file with the. Pub suffix is the public key, and the other file is the key.
- Public keys are public and do not need to be kept confidential, while private keys are held by individuals and must be properly kept and kept in mind.
* * 3. Copy the public key generated by the client to the server side * *
- Log on to the server side to see if there are authorized_keys files in the ~/.ssh directory.
- If you don't create it
- Copy to the client side public key content, paste to the server side just created the Authorized_keys file, save the file.
- Change permissions for a Authorized_keys file
chmod 600 authorized_keys
3. Verify No password login
- Execute the following command on the client side command line:
ssh [email protected]
- Log in directly to the server side, indicating successful validation.
4. Precautions
- Ssh-keygen after execution, be sure to check under Phenix User home directory. Is there a pair of keys in the SSH directory
- After pasting the public key onto the server side, be sure to modify the permissions of the Authorized_keys file to 600, otherwise the authentication will fail
- The server side needs to open the SSH service, otherwise the client will not connect with SSH
Http://daodaoliang.com/blog/2015/03/19/%E4%BD%BF%E7%94%A8SSH%E5%85%8D%E5%AF%86%E7%A0%81%E7%99%BB%E9%99%86.html
SSH Password-free login