SSH Stop Root Login

Leaving your Linux computer open to root login to ssh is a security vulnerability. Its better to login using a user account and then su to root. It might also help prevent you from deleting or changing something with the power of root.

To make the change, as root, open the ssh configuration file: vi /etc/ssh/sshd_config

look for the line #PermitRootLogin no

and either uncomment it or set it to no: PermitRootLogin no

If its not there you’ll need to add it. Then restart the ssh service /etc/init.d/sshd restart

Once you have committed the change its worth logging in with a normal user account to prove that you still have access and with the root account to show that access has been stopped.