Skip to content Skip to sidebar Skip to footer

Reset Forgotten Linux Password

I was having a case where i forgot what is my linux root password, and the worst thing is, my grub is also locked. I am surely cannot logging in. It's installed on my server, and i don't create and use any other standard user because root makes me able to do configuration easily. So i stick with that one.



After taking some time to googling, i find out where is the user and password stored in Debian. It is in a file named shadow. If the debian is running, it can be accessed from root only. Other user cannot access it unless they are given permission by Root. This is the only way i can reset linux password, since there are no other debian default root password.



If you forgot your linux password and willing to reset it, i have my easy and creative ways how you can reset and retrieve it back :
  1. Create a bootable drive of linux live. There is so many linux distros out there. In my case, i am using Linux Mint as bootable drive. You must download it first, and create the bootable drive using flashdisk and software called rufus;

  2. After its done, plug your flashdisk into USB port and boot into it;

  3. Select Linux Mint Live, and wait until desktop appears;

  4. Now open up Terminal, and type Sudo -i. It will elevate you as root so you could modify any files even it is located in your locked Linux;

  5. Open Computer, and find the partition where your locked linux installed. After that, head to etc folder and scroll down until you find shadow;

  6. After you found it, type nano in your terminal plus space. After that, drag the shadow files into terminal. Now your terminal will looked like this :
    nano<space>'The_Location_of_shadow_that_youve_been_dragged'
    Dont hesitate to hit enter;

  7. You now see many lines of user. All you need to do is to find root. You may find it looked like this :

    root:niu32h23i7f2612w64h83r8:$6$lkrusndhsl83.:14862:0:99999:7:::
    Now you should delete any character between the first colon (symbol :) after text root until the next one of it, and now it should have looked like this :


    root::$6$lkrusndhsl83.:14862:0:99999:7:::

    Save by pressing ctrl + x and press y

  8. Reboot and boot into your locked linux, and now login as root. It will not asked you for password.

  9. To add password, type passwd and press enter. Now, type your new password and make sure you type it somewhere just in case you forget it.