How to disable root login in Ubuntu?

by emerald.wunsch , in category: Security , a year ago

How to disable root login in Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by noemy.bosco , a year ago


To disable root login in Ubuntu, you can follow the steps below:

  1. Open the terminal on your Ubuntu system.
  2. Type the following command and press enter to open the configuration file for the SSH daemon:sudo nano /etc/ssh/sshd_config
  3. Scroll down to the line that reads PermitRootLogin yes and change it to PermitRootLogin no.
  4. Save the changes and exit the editor by pressing Ctrl+X, then Y, and then Enter.
  5. Restart the SSH service by typing the following command and pressing enter:sudo service ssh restart

Once you have completed these steps, the root user will no longer be able to log in to your Ubuntu system via SSH. It is generally considered best practice to disable root login as it can help to improve the security of your system.