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 :
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