Previously we connected the CentOS system remotely using the server-side username and password via SSH. This approach is not secure enough and it is recommended to use key authentication in order to improve the security of connection access.
The specific operation and configuration are as follows:
1. Create a key pair (public and private) in Xshell. Click the menu bar "Tools"--"New User key Generation Wizard"
2. Key type and key length can be maintained by default, click Next.
3. Generate the public key pair and click "Next".
4. Set the key name. You can also add a password to the key to improve security.
5. If the key does not set the password, the following window will pop up. Click "Yes" to continue.
6. Copy the following public key or save it as a file.
7. Close the window below to continue.
8. Create a hidden folder in the root directory. ssh/
9. Create the key file Authorized_keys under the. SSH folder and modify the permissions of the key file and the ssh file.
10. Copy the contents of the public key file created above into the key file. (Xshell use Ctrl+insert for copying, shift+insert to paste) save exit.
11. Create a new session, fill in the session name, host IP
- Click on "User Authentication" and select public key and user key. Fill in the user name again. If the key password is set above, enter the appropriate password here.
- Then you can connect.
- Normal no longer enter the password, you can connect directly.
The Xshell is configured to connect to the remote server via the key.
Linux Learning Note (vi)---Xshell connect the CentOS system via public key