How to change SSH port on CentOS 7

One of the most common tasks when setting up a SSH server is to change the SSH port. Changing the standard SSH port is often used as a measure to secure servers, actually, it only prevents automated scanners (crawlers, botnets) and script kiddies from discovering you are using SSH. A serious attacker will not give up its search when port 22 refuses connection. Nevertheless, automated scanners that scan the network for known vulnerabilities take CPU time and bandwidth to be served, avoiding such attempts can indeed prove useful. However, don’t think hiding your SSH port is actually enough to secure your server, server hardening is a complex matter and it will require a broader knowledge.

Changing the SSH port is actually pretty simple :

nano /etc/ssh/sshd_config

Change 22 with the port number of your choice. Be careful: choose an unused/not-well-known port (at least >1023).

We'll see the line which specify the port number like port 7333

But that's not enough you also need to open the new port on CSF firewall ad open the port in the TCP_IN section of the firewall configuration-

Now, it's time to restart the SSH service :

#service sshd restart

 

  • ssh port change
  • 18 Users Found This Useful
Was this answer helpful?

Related Articles

IP Configuration

CentOS 7 For CentOS 7, the network adapter will vary depending on the installation. You will...

How to Change the Remote Desktop RDP Port

Port 3389 is the standard port for remote desktop protocol that powers Remote Desktop Services on...

my VPS with CPANEL and CSF is losing packets

Some customers have noticed that when CSF Firewall is installed and active if you try to ping the...

Extend /home disk volume for Centos7 WHM Servers

Here are the steps to follow to  extend the /home volume of a standard centos7 based Utixo VPS...

Utixo VPS Management control panel

Utixo provides its customers with an extremely advanced VPS control panel that allows customers...

Powered by WHMCompleteSolution