To reset your
root password in
Linux without knowing it already, do this:
-
Reboot
- At the LILO prompt (on x86 - the silo prompt is more applicable on Suns, or the yaboot prompt on ppc), type
linux init=/bin/sh
- Wait for a shell prompt to appear. Type
mount -o rw,remount /
- Type
passwd root
- Enter a new password
- Type
umount /
- Type
sync
(probably unnecessary, but fun)
- Type
sync
(certainly unnecessary, but certain traditions have to be followed)
- Type
sync
(completely and utterly unnecessary, except that not doing so guarantees that everything will go horribly wrong)
- Reboot
- Be happy
- Don't be stupid enough to do that again, you clot
Much the same can be done with most other unices. init=/bin/sh is preferable under Linux because some distributions (such as Debian) require you to know the root password in order to get the shell prompt in single user mode.