Sometime ago I just tested to see if I could login to desktop from root, and I succeeded. I clicked on Others on the userlist and entered root and its password and logged in. Now I'd like to know how we can disable root login altogether. I didn't see any option as such in the Login Screen.

  • If possible, please consider closing some of your other open questions by selecting the best answer (if they have one). Consider which answers have been useful and need an upvote. We need users to maintain their questions so that the site can be an effective tool for the next person with your problems. For more details on best practices consider reading the FAQ on asking questions. – hexafraction Aug 22 '12 at 12:58

On a clean installation of Ubuntu, this should not be possible. This is because Ubuntu by default uses a passwordless root user (i.e. you cannot log in as it directly using normal password-based authentication, such as through the login screen or command-line interface).

However, I suspect that you have changed the password of the root user, in which case I highly recommend that you make it passwordless again (which would disable all forms for password-based login):

sudo usermod -p '!' root

If you use to log in as the root user to do adminastrive tasks, I would urge you to use sudo instead to gain elevated priviliges as a normal user (in the admin group).



To disable the root login (lock the account) open the Terminal and execute:

sudo passwd -l root

You will be prompted for an administrators password (not the root password).
The letters of the password will not appear while you type it.



-p = 'use encrypted password for the new password'

Can you explain please how this would stop root from logging in via GDM?

@Pawan: Follow the steps:

System -> Administration -> Login Screen Setup

Go to the "Security" tab.

Under Options:
Allow root to login with GDM (Checked)

Please let me know if this is the solution!

  • Did you try the solution? – Ilias Feb 9 '11 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.