0

I already set-up my root password in Ubuntu. But for some reasons now I need to set it back to default as when Ubuntu is freshly installed. I no more need my set root password. How can I set it back to default? I know my root password. When I supply with empty password to set it back to default it says "Cannot be empty"

what I was trying to do..

1
  • @Takkat, I agree. Marked. – philsf Jan 29 '16 at 10:42
2

To lock the root account, making it unable to login with a password, use this command:

sudo passwd -l root

It will retain whatever password you have set, but it will be unusable for all purposes.

EDIT: This will be useful for any account, besides root.

To unlock the password for the account you previously locked, use this:

sudo passwd -u root

BTW: as was commented, you shouldn't use the root account, unless you really know what you're doing.

4
  • if i want to enable it again what should i do? – ItsTheBat Jan 29 '16 at 10:27
  • @Vi_Hari: you don't: askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root – Takkat Jan 29 '16 at 10:30
  • thanks, but when running some localhosts for some project purposes it asks for password often. will the change affect only after restart? – ItsTheBat Jan 29 '16 at 10:38
  • Nope. Locking an account (any account, FTM) is a permanent action, until undone with the command above. – philsf Jan 29 '16 at 10:39

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