Ubuntu - SSH - Disable SSH root login

Disabling SSH root login enhances security.

Edit the /etc/ssh/sshd_config file, find the line PermitRootLogin and set it to no.

Then, restart the SSH service to apply the changes.


Edit the /etc/ssh/sshd_config file:

/etc/ssh/sshd_config
PermitRootLogin no

Restart sshd

sudo systemctl restart ssh
 
or
 
sudo /etc/init.d/ssh restart