[nmglug] dude, wheres my password?

Karl Hegbloom karlheg at laclinux.com
Tue Apr 12 18:20:05 PDT 2005


On Tue, 2005-04-12 at 18:20 -0600, joe at highmayhem.com wrote:
> Hello,
> 
> Yeah, I'm that guy. I thought I knew it, I don't remember changing it, 
> but I can't log in as root with any password thats in my head. What can 
> I do? Can I change it to something new? Can I find out what it is?
> 
> What would you do?

Reboot the computer.  If you use 'lilo' for a bootloader, then press the
'Shift' key to get a boot prompt.  Type the name of the kernel you want
to boot with 'init=/bin/bash' appended.  eg:

  boot:  linux init=/bin/bash

If you use the Grub bootloader, then highlight the kernel you want to
boot, and press 'e' to edit the boot commands.  Arrow down to the line
that begins with 'kernel', and press 'e' again.  At the end of the line,
add a space and 'init=/bin/bash' (minus the quotes), then press Enter.
Now press 'b' to boot it.

In either case, you will be at a shell prompt logged in as root.
Nothing will be running, no init.d scripts will have been run, and your
'/' directory will be mounted read only and will be the only one
mounted.  Type:

 mount -o remount,rw /

... to mount it read/write, then run the 'passwd' command to set your
root password.  Then:

 mount -o remount,ro /
 reboot

... and let it boot normally.  You will now have a new root password.

Notice that this is a serious security hole.  That is why both Lilo and
Grub support a password option and have the ability to restrict you from
modifying the command line unless you authenticate first.  The other way
in involves booting from removable media.

If you are an Ubuntu user, you don't need to set a root password.  Just
log in as the sudo user, which is the first user created or any created
with that ability turned on, and use 'sudo COMMAND' and your own
password to run things as root.






More information about the nmglug mailing list