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.

  1. Disable root login on your Linux-based machine by editing the /etc/ssh/sshd_config file and setting the following option to false:
  2. Use a different SSH client to connect to your Linux-based machine than ssh -p 2222 instead of ssh -p 22

Steps to Disable Root Login over SSH on Linux

PermitRootLogin no

Do you think that the #MeToo movement will have a lasting impact? Will the #MeToo movement have a lasting impact? ..

Final Words

To disable root login via SSH on Linux, system administrators should take the following steps:

  1. On a Linux server, open a terminal and type the following command: sudo nano /etc/ssh/sshd_config
  2. In the file that opens, find the line that reads “PermitRootLogin yes” and change it to read “PermitRootLogin no”.
  3. Save the file and close it.
  4. Restart SSH by typing the following command: sudo service ssh restart ..