Secure shell(SSH) default port number is 22.This default port number leads to huge automated DDoS attack on the server.By changing the deault SSH port number will helps to stop many automated DDoS attack because it’s bit harder to get the port number
Here we are going to discussed about changing the default port number on Linux system.
Login to your server via SSH as a root user
To change SSH port number you need to find configuration file.Configuration file of SSH is sshd_config and the location of this file /etc/ssh.
Using below command to edit the configuration file
nano /etc/sshd/sshd_config
To find this line #22 on configuration file and replace the port number as per your wish and save it.
*Before proceeding this make sure the mentioned port number is opened on your server
After that,you will restart SSH service by using the below command
systemctl restart sshd.service
Now you can able to login your server by using replaced port number.