By default, every Linux system has a root user that has access to all commands, files & folders. If someone gets access to root user, then they can misuse your system. So it is important to disable SSH root login in Linux. In this article, we will look at how to do this.
How to Disable SSH Root Login in Linux
Here are the steps to disable SSH root login in Linux.
1. Open SSH configuration
Open terminal and run the following command to open SSH configuration file.
$ sudo vi /etc/ssh/sshd_config
2. Disable SSH Root Login
Look for the following line
Replace it with the following line
Save and close the file.
3. Restart SSH server
Restart SSH Service to apply changes.
$ sudo service ssh restart
$ sudo systemctl restart sshd
That’s it. Now root user will not be able to log into SSH.