Detailed explanation of the idea of ​​xshell remote login to CentOS7 without password login

Detailed explanation of the idea of ​​xshell remote login to CentOS7 without password login

First, let me talk about the general idea:

1. Log in to the CentOS system with a password

2. Configure ssh

3. Generate a secret key using xshell

4. Log in without password

Software and equipment:

xshell (download address (free version), you can also download it from Baidu)

CentOS7.5 (Baidu Cloud Server)

Now let’s get back to the point:

1. Password remote connection CentOS

Open xshell -- File -- New, and the following interface will pop up

Explain what needs to be modified.

Name: To distinguish the server, you can give it any name. Protocol: SSH is the default. Host: The IP address of the machine where the CentOS system is located. Port: 22 by default. You can reconnect: If necessary, you can check it. When the connection is accidentally disconnected, xshell will automatically reconnect.

Select <User Authentication> in the directory on the left, and the following interface will be displayed

Parameter Description:

Method: The verification method when xshell connects to CentOS. For the first time, select Password Username: CentOS username. I use the root account password directly here: The password of the login account is required

Then connect. If you successfully log in, your logged-in username will be displayed in front of the command line, as shown in the figure below.

If the login fails, first check whether the login account exists and whether the password is correct. If there is no problem, check whether the CentOS port is open.

2. Install and configure ssh

1. Install openssh-server

yum install -y openssl openssh-server

2. Modify ssh configuration

Open /etc/ssh/sshd-config using vim

sudo vim /etc/ssh/sshd_config

After editing, save

3. Start the ssh service

systemctl start sshd.service

4. Set ssh to start automatically at boot

systemctl enable sshd.service

5. Create .ssh folder

Create a .ssh folder in the user's home directory

mkdir ~/.ssh

So far, the ssh configuration has come to an end

3. Generate a secret key using xshell

1. Open xshell -- Tools -- User Key Manager

The following window will pop up

Select Generate in the right row of options

Select Next, no modifications are required

The key has been generated, click Next

Parameter Description

Key name: any name you can give it Password: this is the password to verify our identity, it will be encrypted by RSA, here I use 123456 Confirmation: the same as the password above, the purpose is to check whether our two passwords are consistent

Click Next and the following figure will pop up.

Then select Save File to save the public key information. Here I save it as test.pub. After saving, click Finish (xshell will automatically record test.pub)

Then upload test.pub to the .ssh folder we created in step 2

Here I use the rz command (install yum install -y lrzsz, file transfer command)

First, cd ~/.ssh to enter the .ssh folder, then execute rz, a window for selecting files will pop up, select the test.pub file you just generated

Then use ll to check whether the upload is successful

Finally, add the public key in test.pub to authorized_keys (authorized_keys stores public keys)

cat test.pub >>authorized_keys

4. xshell sets up password-free login

Create a new connection and set the name, host, port and other information in the same way. Note that the name should be set differently to facilitate differentiation.

Setting up user authentication

Parameter Description:

  • Method: Select Public key
  • Username: The user who created the .ssh folder. I am the root account here, so the username is root
  • User key: Select test in the drop-down box (the test.pub just created)
  • Password: This is the password you entered when generating the key.

Then connect and you can log in without password.

Summarize

The above is a detailed explanation of the idea of ​​xshell remote login to CentOS7 without password login introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Centos7 network configuration details
  • CentOS7 network configuration under VMware virtual machine (host wireless Internet access)
  • CentOS7 network configuration tutorial under VirtualBox (can connect to the external network)
  • How to connect XShell and network configuration in CentOS7

<<:  Vue realizes picture switching effect

>>:  Summary of MySQL development standards and usage skills

Recommend

Detailed tutorial on compiling and installing python3.6 on linux

1. First go to the official website https://www.p...

How to uninstall MySQL cleanly (tested and effective)

How to uninstall Mysql perfectly? Follow the step...

Detailed installation process of MySQL 8.0 Windows zip package version

The installation process of MySQL 8.0 Windows zip...

Detailed steps and problem solving methods for installing MySQL 8.0.19 on Linux

I recently bought a Tencent Cloud server and buil...

11 common CSS tips and experience collection

1. How do I remove the blank space of a few pixels...

In-depth study of MySQL composite index

A composite index (also called a joint index) is ...

Example of compiling LNMP in Docker container

Table of contents 1. Project Description 2. Nginx...

Upgrade Docker version of MySQL 5.7 to MySQL 8.0.13, data migration

Table of contents 1. Back up the old MySQL5.7 dat...

Detailed explanation of HTML document types

Mine is: <!DOCTYPE html> Blog Garden: <!...

Detailed explanation of real-time backup knowledge points of MySQL database

Preface The need for real-time database backup is...

JavaScript implements select all and unselect all operations

This article shares the specific code for JavaScr...

Detailed explanation of the process of installing MySQL on Ubuntu 18.04.4

Let's take a look at the process of installin...

Mysql solves the database N+1 query problem

Introduction In orm frameworks, such as hibernate...

Detailed explanation of the principle of Vue monitoring data

Table of contents 1. Introduction II. Monitoring ...