Security :SSH Hardening – disable root login and change port.

SSH Hardening – disable root login and change port.

The easiest way to secure SSH is to disable root login and change the SSH port to something different than the standard port 22.
Before disabling the root login create a new SSH user and make sure the user belongs to the admin group .
If you change the SSH port also open the new port you have chosen on the firewall and close port 22.
Open a Terminal Window and enter :

sudo vi /etc/ssh/sshd_config

Change the following and save.

Port <ENTER YOUR PORT>
Protocol 2
PermitRootLogin no

Restart SSH server, open a Terminal Window and enter :

sudo /etc/init.d/ssh restart

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.