To reset your root password in Linux without knowing it already, do this:

  1. Reboot
  2. 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
  3. Wait for a shell prompt to appear. Type
    mount -o rw,remount /
  4. Type
    passwd root
  5. Enter a new password
  6. Type
    umount /
  7. Type
    sync
    (probably unnecessary, but fun)
  8. Type
    sync
    (certainly unnecessary, but certain traditions have to be followed)
  9. Type
    sync
    (completely and utterly unnecessary, except that not doing so guarantees that everything will go horribly wrong)
  10. Reboot
  11. Be happy
  12. 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.