How to change Centos 7 SSH port
Changing the SSH login port on Centos 7 operating systems is quite simple. You can follow the steps below.
1- After accessing our server via SSH, we open the SSHD Configuration file with the following command.
yum install nano -y && nano /etc/ssh/sshd_config
"If the nano command does not work, you can install it with "yum install nano -y".''
2- Find the #Port 22 section on the screen that appears. Delete the # sign at the beginning and write the 4-digit port you want. For example: 3310
After writing, we press CTRL + X. It will then ask for confirmation. After pressing Y, we press Enter to accept the changes and exit.
3- To add the new SSH port to our firewall, we run the following commands according to our port number.
firewall-cmd --permanent --zone=public --add-port=3310/tcp
firewall-cmd --reload
4- We need to restart the service. We use the following command.
systemctl restart sshd.service
5- We can check whether the port has been changed by using the command below.
ss -tnlp|grep ssh
The output on the screen you should see will be as follows.
LISTEN 0 128 *:3310 *:* users:((“sshd”,10783,3))
LISTEN 0 128 :::3310 :::* users:((“sshd”,10783,4))
You can click for our Türkiye location VDS packages.
Can't find the information you're looking for?
You have examined the knowledge base in detail, but if you cannot find the information you need,
Create a Support Ticket-
How to Open Ports in Windows?
207 2
-
How to Grant Windows Administrator Privileges?
184 0
-
How to install Webmin on Ubuntu?
803 2
-
Linux SSH Terminal Commands and Explanations
682 3
-
CentOS Stream 10 Update Commands
768 1
-
CentOS Stream 9 Update Commands
1112 1
-
CentOS Stream 8 Update Commands
621 0
-
What is FreeBSD?
765 2
-
Out: 452 4.3.1 Insufficient system storage
708 2
-
Turning Off Automatic Updates in Windows Operating Systems
822 0