Reset a forgotten root password
Content |
Objective
To reset the root password of a machine when it has been forgotten.
(These methods are also applicable where the machine is administered from some other account using sudo
, as is the default on Ubuntu.)
Methods
In order to reset the password you need to mount the root filing system of the machine to be recovered, without booting any part of the existing installation that would require a password to be entered. Possible methods include:
- Booting from a live distribution (one that can be used without being permanently installed, such as Knoppix or Ubuntu), or
- Booting into single user mode, or
- Running
/bin/sh
instead ofinit
.
No one method is ideal for all circumstances. Possible issues you may encounter include the following:
- A live distribution may have difficulty mounting the root volume if an unusual driver is needed. This could be a driver for the physical device, or the filesystem, or some intermediate aspect of how the storage is presented.
- Some distributions (such as Debian) require a password in single user mode.
- The boot loader may have been configured to prevent changes to the kernel options, or to allow them but require a password.