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

CSS3 implementation example of rotating only the background image 180 degrees

1. Mental Journey When I was writing the cockpit ...

Detailed explanation of CSS elastic box flex-grow, flex-shrink, flex-basis

The functions of the three attributes flex-grow, ...

How to install redis in docker and set password and connect

Redis is a distributed cache service. Caching is ...

Detailed explanation of samba + OPENldap to build a file sharing server

Here I use samba (file sharing service) v4.9.1 + ...

Solution for Vue routing this.route.push jump page not refreshing

Vue routing this.route.push jump page does not re...

The difference between MySQL database stored procedures and transactions

Transactions ensure the atomicity of multiple SQL...

A Deep Understanding of Angle Brackets in Bash (For Beginners)

Preface Bash has many important built-in commands...

mysql5.7.19 winx64 decompressed version installation and configuration tutorial

Recorded the installation tutorial of mysql 5.7.1...

Learn more about MySQL indexes

1. Indexing principle Indexes are used to quickly...

Solve the 1251 error when establishing a connection between mysql and navicat

I reinstalled the computer and installed the late...

Implementation process of nginx high availability cluster

This article mainly introduces the implementation...

Brief analysis of the various versions of mysql.data.dll driver

Here is the mysql driver mysql.data.dll Notice: T...

ftp remotely connect to Linux via SSH

First install ssh in Linux, taking centos as an e...

Introduction to NFS service construction under Centos7

Table of contents 1. Server 2. Client 3. Testing ...