How to change the root password if you've forgotten it?

First of all you have to pass the linux kernel a boot-time parameter, ie before booting you have to tell Linux not to do the regular stuff but something special. Now, if you've got LILO installed press Ctrl-X to get to the text mode. Then press tab and see by what name does LILO refer to you Linx kernel image. Mine refers it to as "mykernel" yours most probably would be called "linux". So you type this:

boot: linux init=/bin/sh
Instead of the regular rigmarole, liux will now boot with just the shell. It will give you a bare system with you root filesystem mounted in read-only mode. So now, before you do something else you go ahead and mount the filesystem as read-write.
# mount -o remount,rw /
# mount /proc
I am not sure whether you really need to mount the proc filesystem. Now to actually change the password:
# passwd
But the job aint over - dont aim for that reset button yet..... now you gotta get your filesystems back in read-only state, so that you can shut-down the system without any data loss.
# umount /proc
# mount -o remount,ro /
Note: the command is umount and not unmount

Frequently Used Options
See also common Linux Commands

Have a Linux Issue?
Do you have a Linux Question?

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.