[plug] Root password

Leon Brooks leon at brooks.fdns.net
Thu Nov 11 15:26:06 WST 2004


On Thursday 11 November 2004 07:34, Joong Cho wrote:
> How do you retrieve the password for root? I accidentally changed the
> password for root and I forgot my password. How do you retrieve
> passwords in Linux?

You don't retrieve passwords, they're write-only.

If you're booting from LILO, hold down shift until you get a prompt, 
then type the name of the kernel you're booting (typically "linux", or 
type a tab to see a list), space, 1, enter.

If that fails, replace the 1 with "init=/bin/bash" then do this when it 
boots:

    mount -o remount,rw /
    passwd root
    sync
    sync
    mount -o remount,ro /
    sync
    sync
    reboot

If your LILO has a password set that you don't know, then boot Knoppix 
or similar and read it from /etc/lilo.conf, then reboot and use it.

Once you're up again, *add* a LILO password that you'll remember, then 
tell the BIOS not to boot from CD and add a memorable supervisor 
password to that, too. The first time a machine gets stolen by amateur 
idiots, you'll be glad you did - and you'll change anything else that 
uses those passwords anyway.

GRUB has some slightly more complex magic, but I can't remember it.

Cheers; Leon



More information about the plug mailing list