Detailed description of SSH key logon under CentOS6.5
I. Necessity of key Logon
Generally, SSH key logon is safer than Account Password Logon. Sometimes, the company needs to configure Server logon for new colleagues. Generally, SSH key logon is directly configured.
Ii. SSH key logon Step 1. Key Generation
There are usually many ways to generate a key. Here, we use SSH-genkey to generate the key on the positive server, and use puttygen of the client to convert the key.
For example:
-T indicates the encryption method. Then, change the public key name to authorized_keys.
In addition, make sure that the permission for the. ssh directory is 600. If not, use chmod 600. ssh to set the permission. The main purpose is to prevent others from putting the public key under. ssh so that they can log on without a password.
Then, use pscp to load the Private Key to the local machine and use puttygen for conversion.
2. Logon Settings
:
3. After Successful Login
Iii. FAQs. Question 1: server refused our key.
Cause: If you view the log, you can know that the. ssh context is not securely blocked by SELinux.
Solution: restorecon-Rv. ssh. Log On after successful execution.
Problem 2: only the root user can log on, and other users cannot log on.
Cause Analysis: It is generally because. ssh is not set in the corresponding directory
Solution:/root/. ssh/the root account public key is set in this directory. For user A, go to/home/A/. ssh and perform the same settings as root.
For example: