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

I was asked for root credentials to setup my printer in Ubuntu. This seemed to be caused by a bug. And the suggested workaround is to create a root password. Since it is default that no root password is used in Ubuntu, i wonder how i could revert this changes.

Once i have set a password for root, is there a method to disable it again?

share|improve this question
up vote 47 down vote accepted

According to Ubuntu online help

Ubuntu developers made a conscientious decision to disable the administrative root account by default in all Ubuntu installations. This does not mean that the root account has been deleted or that it may not be accessed. It merely has been given a password which matches no possible encrypted value, therefore may not log in directly by itself.

If you want to enable root account simply give it some password using

sudo passwd

When you enter this command you will be asked for new password. The password you enter will be the password for root account so be careful and choose a strong password.

To disable the root login use

sudo passwd -l root

This will disable the login using root user name i.e your system will be back to previous state.

If you want more information on Ubuntu user management read the official documentation.

share|improve this answer
Use sudo passwd -S root to check if locked or not (will have L in output instead of P). – Wtower Jun 22 '15 at 10:07
sudo usermod -p '!' root

That will set the root account to have an unusable password.

You can also lock the account to stop people logging in.

sudo passwd -l root

Either approach should do what you want. You don't need to do both.

share|improve this answer
I don't get it. Why an unusable password? – Tshepang Jan 7 '11 at 12:54
Unusable in that you cannot log in with it. It's what the password starts off as AFAIK. – Oli Jan 7 '11 at 12:56
when i disable it with: sudo passwd -l root. do i have to remember the current root password for future use, perhaps if i someday want to activate root password again? – NES Jan 7 '11 at 13:16
@NES no you dont have to remember it. you reset the password and time with "sudo passwd" – binW Jan 7 '11 at 14:01

It's not true that there is no default root password. Instead, root has a blank password.

If you define another password, you don't have to use it.

share|improve this answer
If there is a password it means people could log in if they knew the password. Resetting the password back to nothing or locking the root account is better for security. – Oli Jan 7 '11 at 12:54
So the password you assign shouldn't be one which could be guessed. Perhaps I'm thinking of the owner of the system as the only user. Surely, the owner of the system should know the root password, if there is one. Hmm! 4 downvotes .. you people are even more harsh than the ones on Slashdot. – pavium Jan 7 '11 at 13:16
Never mind, anybody can be wrong. You can delete your answer, if you want. You'll even get a badge for it. :-) – Stefano Palazzo Jan 7 '11 at 13:48
I don't think I am wrong. I just have a different opinion. And I didn't mean Slashdot, I meant Stackoverflow, where there are similar penalties for disagreeing with Jon Skeet. – pavium Jan 7 '11 at 20:18

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.