Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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).


share|improve this answer
share|improve this answer

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.

share|improve this answer


-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!

share|improve this answer
Did you try the solution? – Ilias Feb 9 '11 at 9:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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