Skip to main content

Reset Ubuntu Server Password from GRUB

Resetting a Forgotten Ubuntu Password via GRUB

If you've forgotten your Ubuntu server password, you can reset it using the GRUB boot menu. You can reset via one of these two methods: using recovery mode or editing the GRUB boot parameters.

Method 1: Using Recovery Mode

This method is recommended for most users as it is more straightforward.

  1. Reboot the server.
  2. While the server is starting, press and hold Shift (or Esc for UEFI systems) to display the GRUB menu.
  3. In the GRUB menu, select Advanced options for Ubuntu and press Enter.
  4. Choose the entry that includes (recovery mode) and press Enter to boot into the recovery menu.
  5. Select root: Drop to root shell prompt and press Enter.
  6. By default, the file system is mounted as read-only. Remount it with read-write permissions:
    mount -rw -o remount /
  7. To find your username (if you don't know it), list the home directories:
    ls /home
  8. Reset the user's password:
    passwd <username>
    Replace <username> with your actual username. Follow the prompts to set the new password.
  9. Type exit to return to the recovery menu.
  10. Select resume: Resume normal boot to restart your server.
info

After reboot, you can log in with the new password.

Method 2: Editing GRUB Boot Parameters

This method boots directly into a root shell, skipping the recovery menu.

  1. Reboot and hold Shift or Esc to enter the GRUB menu.
  2. Select the standard Ubuntu boot entry and press e to edit.
  3. Find the line starting with linux /boot/vmlinuz-....
  4. Remove the parameters ro quiet splash and append:
    rw init=/bin/bash
  5. Press F10 or Ctrl+X to boot.
  6. The system will boot to a passwordless root shell. Set the password:
    passwd <username>
  7. After resetting the password, reboot the system:
    exec /sbin/init
caution

Use these methods only on systems you are authorized to access.