Thursday, October 25, 2018

grub2 - Root shell is not helping in recovering access to administrator account whose password I have lost




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



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


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...