How to modify the ssh port number in Centos8 environment

How to modify the ssh port number in Centos8 environment

Preface

The default ssh port number of the server is generally 22, so most users need to change the default ssh port number for security reasons. The following is how to change the default ssh port number:

This experiment is based on the fact that I changed the port number to 2222 before. Now I changed it back to 22, so I finally connected to port number 22. Whether you change it to something else or change it back, the method is the same.

start

Enter edit mode:

vi etc/ssh/sshd_config

Then press i to enter insert mode

Move the cursor below #Port 20

Enter the Port number

insert image description here

Then press Esc to exit the insert mode, enter: wq to save and exit, and return to the current interface

insert image description here

Then enter

setenforce 0

Restart sshd file

systemctl restart sshd

Turn off the firewall to prevent modification failure

systemctl stop firewalld

insert image description here

Then restart the virtual machine

reboot

insert image description here

Log in again to get dhclient to view the IP address

insert image description here

Then reconnect:

insert image description here

This is the end of this article about how to modify the ssh port number in the Centos8 environment. For more information about how to modify the ssh port in Centos8, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Shell script settings to prevent brute force ssh
  • What is ssh port forwarding? What's the use?
  • What is ssh? How to use? What are the misunderstandings?
  • Detailed explanation of Linux remote management and sshd service verification knowledge points
  • ssh remote management service

<<:  Comprehensive understanding of html.css overflow

>>:  Solve the problem that the default value of CSS3 transition-delay attribute is 0 without unit and it is invalid

Recommend

Detailed explanation of the execution process of JavaScript engine V8

Table of contents 1. V8 Source 2. V8 Service Targ...

Vue implements a movable floating button

This article example shares the specific code of ...

Share the responsive frameworks commonly used by web design masters (summary)

This article introduces and shares the responsive...

How to Apply for Web Design Jobs

<br />Hello everyone! It’s my honor to chat ...

Nginx content cache and common parameter configuration details

Use scenarios: The project's pages need to lo...

Mysql solves the database N+1 query problem

Introduction In orm frameworks, such as hibernate...

Use CSS to create 3D photo wall effect

Use CSS to create a 3D photo wall. The specific c...

Summary of the understanding of virtual DOM in Vue

It is essentially a common js object used to desc...

Docker container connection implementation steps analysis

Generally speaking, after the container is starte...

Vue implements upload component

Table of contents 1. Introduction 2. Ideas Two wa...

MySQL 5.5.56 installation-free version configuration method

The configuration method of MySQL 5.5.56 free ins...