How to Use the Xshell key to log on to CentOS (password-less logon)

Source: Internet
Author: User

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:

  1. # Make sure that you use pwd in the user's home directory. I am logged on as root, so under/root.
  2. # 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.
  3.  
  4. Mkdir. ssh
  5. # Creating a. ssh directory
  6.  
  7. Chmod 700.ssh
  8. # Grant. ssh directory 700 permissions
  9.  
  10. Cd. ssh
  11. # Enter the. ssh directory
  12.  
  13. Touch authorized_keys
  14. # Create an authorized_keys File
  15.  
  16. Chmod 600 authorized_keys
  17. # Grant authorized_keys file 600 Permissions
  18.  
  19. Vi authorized_keys
  20. # Use vi to edit it


Press the I key to enter the editing mode, paste the Public Key generated by Xshell, save and exit.

  1. Vi/etc/ssh/sshd_config
  2. # Edit the sshd configuration file
  3.  
  4. Remove the # In front of the following two sentences
  5. PubkeyAuthentication yes
  6. AuthorizedKeysFile. ssh/authorized_keys
  7.  
  8. Change yes to no.
  9. PasswordAuthenticationno
  10.  
  11. Save and exit.
  12.  
  13. Service sshd restart
  14. # Restart the sshd service
  15.  
  16. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.