Skip to content

Instantly share code, notes, and snippets.

@KitBaroness
Created November 22, 2025 03:35
Show Gist options
  • Select an option

  • Save KitBaroness/1df43bf4054aec9db1a4a4bebdffc687 to your computer and use it in GitHub Desktop.

Select an option

Save KitBaroness/1df43bf4054aec9db1a4a4bebdffc687 to your computer and use it in GitHub Desktop.
Forgot to Your PassWord | LINUX Reset

Step-by-Step Guide to Using GRUB to Edit the Boot Line

  1. Reboot Your System:

    • Restart your computer and wait for the GRUB menu to appear. If it doesn’t show up by default, hold the Shift key during boot.
  2. Edit the GRUB Boot Parameters:

    • Once the GRUB menu is visible, highlight the default boot entry (usually the first option, which is your main Ubuntu system).
    • Press e to edit the boot parameters for the selected boot entry.
  3. Modify the Boot Line:

    • Now you will see the boot configuration for your selected Ubuntu kernel.
    • Look for the line starting with linux. This is where the boot parameters are defined.
    • Use the arrow keys to navigate to the end of this line and add the following text (after the existing parameters):
    init=/bin/bash

    This tells the system to boot directly into a bash shell as the root user, bypassing the usual login process.

  4. Boot with the Modified Parameters:

    • After adding init=/bin/bash, press Ctrl + X or F10 to boot with these settings. Your system will now boot to a root shell without asking for a password.
  5. Remount the Filesystem:

    • Once you are at the root shell prompt, the filesystem will be mounted in read-only mode. To make changes, you'll need to remount it as read/write:
    mount -o remount,rw /
  6. Reset Your Password:

    • Now, reset your user’s password using the passwd command. Replace your_username with your actual username:
    passwd your_username
    • Enter a new password when prompted. Type it again to confirm.
  7. Reboot Your System:

    • After resetting the password, reboot the system to go back to normal boot:
    exec /sbin/reboot

    Or you can just type:

    reboot

What Happens Next

  • Your system will reboot normally, and you should now be able to log in using your new password.

Summary:

  • You use F2 (or e) in the GRUB menu to edit the boot line temporarily.
  • Add init=/bin/bash to boot straight into a root shell.
  • Reset your password using passwd your_username.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment