document updated 15 years ago, on Aug 23, 2009
Once in a while, someone will install the OS, but won't use the proper username+password, and then nobody knows how to log into the box.
There are two ways to modify files: 1) use GRUB to boot into no-root-password mode, or 2) boot into tomsrtbt.
use GRUB to bypass root password
At the GRUB prompt, go in and change the boot parameters, and add 'single'. It should boot you into a limited environment, without asking for the root password.
Boot into tomsrtbt
- boot into an ISO of tomsrtbt
Knoppix or SLAX are nicer, but sometimes older computers can't do the floppy-emulation⇒CD jump, and tomsrtbt will never have this problem. And really, the most sophisticated thing needed for this job is 'vi' and ext3, both of which tomsrtbt supports
- fdisk -l to find out what device the HDD was loaded as
- create a directory for that dev under /mnt/, and mount it
To fix the username
- use a text editor to change the username in these files ('vi' is available on tomsrtbt):
- /etc/passwd
- /etc/shadow
- /etc/group
- move the home directory from /home/???/ to /home/user/
To fix the password
- just clear the password field of /etc/shadow for the desired user
- after booting into the system, be sure to set the password