Monday, 22 December 2025

Linux Operating System DEBIAN 13 _ Forgot root password

 

MICROSOFT Copilot Answer

 

 

Got it 👍 — forgetting the root password on Debian (or any Linux system) is a common headache, but you can reset it safely. Here’s a clear step‑by‑step guide:


🔑 Resetting the Root Password in Debian 13

1. Reboot into GRUB

  • Restart your computer.
  • When the GRUB boot menu appears, highlight your Debian entry.
  • Press e to edit the boot parameters.

2. Modify the Boot Parameters

  • Find the line starting with linux (it usually ends with quiet splash).
  • At the end of that line, add:
    init=/bin/bash
    
  • This tells the system to boot directly into a bash shell.

3. Boot into Single-User Mode

  • Press Ctrl + X or F10 to boot with the modified parameters.
  • You’ll land in a root shell without needing a password.

4. Remount the Filesystem

By default, the root filesystem is read-only. Make it writable:

mount -o remount,rw /

5. Reset the Root Password

Now set a new password:

passwd
  • Enter your new root password twice.

6. Sync and Reboot

  • Write changes to disk:
    sync
    
  • Reboot the system:
    exec /sbin/init
    
    or simply:
    reboot -f
    

✅ After Reboot

  • Log in with your new root password.
  • If you use sudo with a non-root account, you may also want to update that user’s password with:
    passwd username
    

⚠️ Important Notes

  • This method requires physical access to the machine (you can’t do it remotely).
  • If your system uses full disk encryption, you’ll still need the encryption passphrase before reaching GRUB.
  • Always choose a strong password to avoid future lockouts.

Would you like me to also show you the alternative method using Debian’s recovery mode (instead of editing GRUB manually)? That way you’ll have two options depending on what’s easier for you.



Norizan Answer

Another good reference is here . Thank you very much for this excellent tip . Keep up the good work . 



No comments:

Post a Comment