Change the default SSH listening port

Change the default SSH listening port

One of the first things to do on your server is to configure the SSH port.
By default SSH service is listening on 22 port, but it's advisable to change it and not to leave it set to default values.
Because many new bots attack the default SSH port and make a brute-force to try to hack our login details.
To avoid these requests what you need is only follow this guide.

Run this command to open the service file configuration with the editor nano:

nano /etc/ssh/sshd_config

At the beginning of the file you will find something like that:

#Port 22

Uncomment this line removing the "#" character and change the number port from 22 to whatever you want but pay attention to put a port that is not already used.

After that save and exit from the editor, to apply these setting you need to restart ssh service by run this command: service ssh restart or service sshd restart

  • security, ssh
  • 1168 Users Found This Useful
Was this answer helpful?

Related Articles

Change IP address on every operating systems

Change IP Address of your Server Prerequisites To change the public IP Address of your Linux...

Update your system

Update your system Before start using your VPS/Dedicated Server, you need to update your system...

Change root password

Change root password When a new server is deployed or is reinstalled a generated password will...

Configure Multiple Domain on your website Cpanel

Cpanel Aliases Overview Domain aliases are domains that you own, but which do not contain any...

Setup Cron Jobs on cPanel

Cron Jobs Overview Cron jobs are scheduled tasks that the system runs at predefined times or...