How to Use the Xshell key to log on to CentOS (password-less logon)
I recently attended a training session and talked about how to log on to CentOS with a key. This authentication method is more secure than logon with a user name and password, so you must learn about it. I have been using Xshell, and other terminal software will not be discussed. Please use Baidu. Next let's take a look at how to use Xshell to implement key authentication and log on to the CentOS system.
Open Xshell, Click Tools-> Create User Key Generation wizard
Select RSA as the key type. The key length is 2048 bits. Next Step
Prompt that you are generating the public key and private key pair. Next Step
Name the private key and set the password. Next Step
This is the generated public key. Save it and use it later. Click Finish.
Click Close to close your private key.
Next, log on to the system using the username and password, and make the following Configuration:
- # Make sure that you use pwd in the user's home directory. I am logged on as root, so under/root.
- # Check whether there is any. ssh hidden directory under your home directory. If there is any hidden directory, go directly to it. If not, create a new one.
-
- Mkdir. ssh
- # Creating a. ssh directory
-
- Chmod 700.ssh
- # Grant. ssh directory 700 permissions
-
- Cd. ssh
- # Enter the. ssh directory
-
- Touch authorized_keys
- # Create an authorized_keys File
-
- Chmod 600 authorized_keys
- # Grant authorized_keys file 600 Permissions
-
- Vi authorized_keys
- # Use vi to edit it
Press the I key to enter the editing mode, paste the Public Key generated by Xshell, save and exit.
- Vi/etc/ssh/sshd_config
- # Edit the sshd configuration file
-
- Remove the # In front of the following two sentences
- PubkeyAuthentication yes
- AuthorizedKeysFile. ssh/authorized_keys
-
- Change yes to no.
- PasswordAuthenticationno
-
- Save and exit.
-
- Service sshd restart
- # Restart the sshd service
-
- PS: If you want to disable remote root login, remove the # PermitRootLogin yes statement and change the # to no.
Now let's try it. Enter the user name root.
Have you seen it? The password text box turns gray. Select the generated User Key, enter the password of the key, and click OK.
OK! It is not difficult to successfully implement the Xshell key authentication and log on. Please try it now.
Xshell uploads files to Linux Hosts in Windows
Troubleshooting of Chinese garbled characters when Xshell logs on to CentOS 6.3
VirtualBox4.12 text installation CentOS 5.4 and Xshell connection tutorial PDF
Xshell connects to CentOS6.5 iptables or ls to output garbled characters
Use Xshell to log on to VMware Linux
Use the Xshell key authentication mechanism to remotely log on to Linux