Log in to the Linux system using the Xshell tool key authentication

Source: Internet
Author: User

Linux Server system security issues, may be you want to consider, and the system login mode there are two, passwords and keys. Which one is more secure? It is undoubtedly the latter, here to share with Xshell using the key way to log on to the Linux server!

About Xshell, it is a powerful secure terminal emulation software that supports the Telnet protocol of the SSH1,SSH2 and Microsoft Windows platforms. Similar to the putty, SecureCRT and so on.


Tools/Materials

Linux

Xshell

Method steps

① Generating the public key

Click Tools on the Xshell menu and select the new User Key Generation Wizard to perform key pair build operations.

Prompting you to generate a public and private key, the next step

Name and set the password for the private key, next

Generate the public key, save it for a while, and click Done.

Click the Xshell tool, the user Key Manager, which is the private key, click Close

② Copy a public key

Copy the public key that you just generated and paste it into the Linux file, the following steps are described below.

# mkdir/root/.ssh #<== Create/root/.ssh directory, because this directory does not exist by default

# chmod 700/root/.ssh #<== Change permissions for this directory 700 The origin is r=4 w=2 x=1 represent read, write, execute respectively

# Vi/root/.ssh/authorized_keys #<== Paste the contents of the public key into the file Root/.ssh/authorized_keys

③ Close SELinux

SELinux is a security mechanism for CentOS, and the way to turn off SELinux

# Setenforce 0 #<== This is just a temporary shutdown, the next time you restart Linux, SELINUX will also open, want to permanently shut down needs to be modified, selinux=enforcing for selinux=disabled

# Vi/etc/selinux/config

Enter after change, selinux=enforcing for selinux=disabled then: Wq save exit, last reboot system

④ Startup key Authentication login, at the same time for the sake of security system, the way to turn off password Authentication!

# vim/etc/ssh/sshd_config #<== edit this file

Modify the following places:

Pubkeyauthentication Yes #<== enable PublicKey authentication

Authorizedkeysfile. Ssh/authorized_keys #<==publikey File path

Passwdathentication no #<== Not applicable password Authentication login

After setting these parameters, perform service sshd restart restart services

⑤ Login with key and enter username root

The password input box becomes grayed out because the Passwdathentication no #<== in Vim/etc/ssh/sshd_config is not suitable for password Authentication login), the user key is selected just generated, and enter the password, Click OK.


Log in to the Linux system using the Xshell tool key authentication

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.