4

I lost administrative password.

I have tried - I know the regular method by which I go to GRUB menu and go to root (drop to root shell prompt) and set password there. It is well described - here. To be more specific I am aware about this method and have set the password many times when I have lost it before.

My problem - now my problem is that this method is not working. When I drop down to root shell it asks for root password again without which it does not progress. I do not have this password! What is the alternative then??

  • 2
    Use a live USB: askubuntu.com/a/435347/158442 – muru Sep 24 '15 at 13:54
  • is there no any other way out?? – sangharsh Sep 24 '15 at 13:57
  • one more thing: @muru - have negatively marked this question? if yes, may I know the reason? – sangharsh Sep 24 '15 at 13:58
  • What's wrong with using a live USB? – muru Sep 24 '15 at 13:58
  • 1
    Fine I have removed the possible duplicate ;) – hg8 Sep 24 '15 at 14:13
2

If you can access the root partition from another system, e.g. a live CD, you can as root from there edit /etc/shadow; first you have to chmod u+w shadow. Find the entry for root, it's probably the first one and looks something like this:

root:$6$asdG0[..etc...]ae/:15666:0:99999:7:::

Erase everything between the first two colons so you end up with:

root::15666:0:99999:7:::

Then chmod u-w shadow. You can now reboot the system and root will have no password. You can just type root at the login prompt and it won't ask for one. You can then use passwd to set one.

Edit 1

Boot to the Live media. Open a terminal. Find out the device name for your primary disk. sudo fdisk-l will list all partitions.Like /dev/sda1 Mount this somewhere so we can use it:

sudo mount /dev/sda1 /mnt

Then change directory

sudo cd /mnt/etc

change privilage

sudo chmod u+w shadow

edit file like I write

from

root:$6$asdG0[..etc...]ae/:15666:0:99999:7:::

to

root::15666:0:99999:7:::

then

u-w shadow

Reboot

  • sorry, I have not understood this part - "you can as root from there edit /etc/shadow;" in your answer. – sangharsh Sep 24 '15 at 14:06
  • Don't! change the permissions of shadow. Use vipw -s instead. – muru Sep 24 '15 at 14:13
  • 1
    I edit my answer – 2707974 Sep 24 '15 at 14:22
  • Let us hope @blade19899 does not see this >:-D – Rinzwind Sep 24 '15 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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