Reset root password
This guide will show you how to reset a forgotten root password. Several methods are listed to help you accomplish this.
Using a LiveCD
With a LiveCD a couple methods are available: change root and use the
passwd command, or erase the password field entry directly editing the password file. Any Linux capable LiveCD can be used, albeit to change root it must match your installed architecture type. Here we only describe how to reset your password with chroot, since manual editing the password file is significantly more risky.
- Boot the LiveCD and mount the root partition of your main system.
- Use the
passwd --root MOUNT_POINT USER_NAMEcommand to set the new password (you won't be prompted for an old one).
- Unmount the root partition.
- Reboot, and enter your new password. If you can't remember it, go to step 1.
Using GRUB to invoke bash
- Select the appropriate boot entry in the GRUB menu and press
eto edit the line.
- Select the kernel line and press
eagain to edit it.
init=/bin/bashat the end of line.
Ctrl-Xto boot (this change is only temporary and will not be saved to your menu.lst). After booting you will be at the bash prompt.
- Your root file system is mounted as readonly now, so remount it as read/write
mount -n -o remount,rw /.
- Use the
passwdcommand to create a new root password.
- Reboot by typing
reboot -fand do not lose your password again!
- this guide for an example.