Can't change root password in Ubuntu

6,247

Solution 1

The root account is locked by default in Ubuntu. When sudo asks for a password, you give it your user's password, not root's. This works because your user is in the sudo group and therefore has permission to run commands as root. If what you want is to reset your password, just run

passwd

If you have enabled the root account in Ubuntu and want to change that password, boot into recovery mode, log into a "root shell prompt" and reset there.

  1. Remount the / filesystem read/write

    mount -o rw,remount /
    
  2. Reset the password

    passwd
    

Solution 2

As one of the comments on your question suggested, there is a quite high probability that your root filesystem, "/" might be mounted read-only.

Try this command to see if it is the case:

sudo touch /testfile

if you get something like "can not create" or alike, you might want to try this command:

sudo mount -o rw,remount /

I have had reasonably high percentage of success, but sometimes it just doesn't fix the situation, forcing you to reboot. Trying it is easier than a reboot for sure.

Share:
6,247

Related videos on Youtube

Ashot
Author by

Ashot

Updated on September 18, 2022

Comments

  • Ashot
    Ashot over 1 year

    I am trying to change the root password in my Ubuntu system but I am getting an error. I disabled password prompt when calling sudo. So I can execute root commands (eg. sudo apt-get install) without typing root password.

    ashot@ashot-desktop:~$ sudo passwd root
    passwd: Authentication token manipulation error
    passwd: password unchanged
    
    • Ex Umbris
      Ex Umbris almost 11 years
      Have you tried just sudo passwd ?
    • Ashot
      Ashot almost 11 years
      Yes, the same error
    • Ex Umbris
      Ex Umbris almost 11 years
      What about sudo -s -H (to launch a sub-shell as root) followed by passwd?
    • Ashot
      Ashot almost 11 years
      Again the error
    • Ex Umbris
      Ex Umbris almost 11 years
      Is the root filesystem r/o?
    • Ashot
      Ashot almost 11 years
      How to check it?
    • dawud
      dawud almost 11 years
      sudo su - to obtain a root shell and change the password there