Can't change root password in Ubuntu
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.
-
Remount the
/
filesystem read/writemount -o rw,remount /
-
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.
Related videos on Youtube
Ashot
Updated on September 18, 2022Comments
-
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 almost 11 yearsHave you tried just
sudo passwd
? -
Ashot almost 11 yearsYes, the same error
-
Ex Umbris almost 11 yearsWhat about
sudo -s -H
(to launch a sub-shell as root) followed bypasswd
? -
Ashot almost 11 yearsAgain the error
-
Ex Umbris almost 11 yearsIs the root filesystem r/o?
-
Ashot almost 11 yearsHow to check it?
-
dawud almost 11 years
sudo su -
to obtain a root shell and change the password there
-