6

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??

sangharsh
  • 782
  • 8
  • 18
  • 2
    Use a live USB: http://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
  • I haven't yet, but if you want, I'll downvote. :P – muru Sep 24 '15 at 13:58
  • @hg8 : sorry but I have already checked the answers for the question which you have mentioned. All most all of them are similar and only one answer which asks me to use live cd is applicable to me. I am looking for answer which does not ask me to use live cd. – sangharsh Sep 24 '15 at 14:12
  • 1
    Fine I have removed the possible duplicate ;) – hg8 Sep 24 '15 at 14:13
  • @muru - :D ... no no... please do not down vote! the only problem with USB is that I do not have one! fine. I will try to solve this "hardware" problem instead of looking for software solution and spending my time. – – sangharsh Sep 24 '15 at 14:13
  • This question does not have an answer here "How do I reset a lost administrative password?" I do not understand what is going on. I mention in my question that the said question does not answer my question still why do I see this possible answer link always???? – sangharsh Sep 26 '15 at 05:05

1 Answers1

3

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

2707974
  • 10,553
  • 6
  • 33
  • 45