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.
You have examined the knowledge base in detail, but if you cannot find the information you need,
Create a Support Ticket