SSH, or secure shell, is a networking protocol used by two computers connected to a network to exchange messages and files. When a system needs to be accessed remotely, this protocol is useful. SSH makes working simple and available from any location.
Every Linux-based computer comes with a default root user who has full access to the system; by default, you always act in the root user role. To prevent unauthorized access to your Linux-based machine by any other user, it is recommended by security best practices that you disable root login via SSH.
No one will have unrestricted access to your Linux-based machine if root login is disabled because root access is prevented via SSH. Per best security practices, you should add a second user to the account that has almost all superuser rights. We have mentioned the steps below to Disable root login over SSH on Linux
Steps to Disable Root Login over SSH on Linux
“AllowRootLogin yes”
“No AllowRootLogin”
“sshd service restart”
Final Words
We hope you enjoy our article on how to Disable root login via SSH on Linux. On Linux, the root account is often the one that SSH crackers target. System administrators can have serious security concerns if the SSH root account on a Linux server is activated and exposed to the network or, even worse, the Internet. Under all circumstances, you should disable SSH root account on Linux to strengthen server security. When connecting to a remote server using SSH, you should only use a regular user account at first.