Open In App
Related Articles

Resetting a root password in Linux without external media

Improve Article
Save Article
Like Article

We have to follow 8 steps to crack root password without using any external media

  • Step-1 :¬†Reboot the system and interrupt the boot loader countdown timer by pressing any key except enter.
  • Step-2 : ¬†Find the entry that is normally booted, and change it to halt execution during the initial ram disk.
    • 2.1. Use the cursor keys to highlight the entry that is normally booted and press e
    • 2.2. Use the cursor to move to the line that has the kernel and kernel arguments. This line normally starts with
      linux16 or linuxefi.
    • 2.3. Move the cursor to the end of line by pressing End, and add rd.break.
    • 2.4. Press Ctrl+x to boot using the modified stanza and you will get a command line interface.
    • Step-3: On command line Interface you have to write command
      # mount -o remount,rw /sysroot

      Here we are mounting the system read-write . The file system is mounted under /sysroot.

    • Step-4 : Change the working root to /sysroot directory.
      # chroot /sysroot
    • Step-5 : Now you can change password
      #passwd root
    • Step-6 : Now make sure that all the unlabeled files(like /etc/shadow) get relabeled during boot so run the command
      #touch /.autorelabel

    • Step-7 : Now by running command exit you can exit from interactive shell.
      # exit
    • Step-8 : Now again run exit command by which you can exit from command line interface and booting process will start again with new root password.
      # exit

    • This article is contributed by Kshitij. If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

      Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Last Updated : 29 Sep, 2022
Like Article
Save Article
Similar Reads