RSS



Forgot your root password? No problem, just reset it.

Tue, May 22, 2007

ArsGeek, Linux, howto

Talk about it in our Forums

root.pngHave you ever lost your root password on a Linux install? It can be painful casting about for your password, lifting keyboards and thumbing through your wallet in hopes of a moldy sticky note with scrawled pencil on it.

Well relax friend, there’s an easier way to recover your root password. You just reset it!

To do this, you’ll need to enter something called Runlevel 1. It’s not quite like that level in Super Mario Bros., but close. Here you’ll be accessing the computer in what’s called Single User Mode (no reflection on your marital or dating status). The only catch is you’ve pretty much got to do it in person (or through a TTY console).

How to do it? Let’s reboot to start with. Please also note that this tutorial focuses on Linux based on debian with Grub as a bootloader. (Yes, that includes Ubuntu).

Once your computer shuts down, hover your hand over the the keyboard and prepare yourself for some fast ESC key action. As soon as you see the word GRUB appear on your screen, tap that ESC key.

Now, go to the top option (the most recent kernel) and we’re going to edit it to boot into single user mode. This edit is a one time thing, so afterwards you can forget you’ve ever done this.

First, while the entry is highlighted, press ‘e‘. Next, go to the kernel line (something like “kernel /boot/vmlinuz-. . .“) and press ‘e‘ again.

Now, using those handy arrow keys, go the very end of the line and leaving one space, type:

single

Press that ESC key again, and then for a slight change of pace we’ll try the ‘b‘ key to boot your machine.

You’ll see a bunch of text scroll by as you boot into the text only Single User Mode (again, no reflection on your man or woman hood).

After a bit, it will spit up a prompt for you. Congratulations! You’re the root user. Now all that’s left is to change the password to something you know.

passwd

When prompted, enter in something wonderfully secure and robust.

Now reboot by typing reboot.

Technorati Tags: , , , , ,

Popularity: 2% [?]

Share and Enjoy:
  • Digg
  • del.icio.us
  • MisterWong
  • Reddit
  • Technorati
  • BlinkList
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1980 posts on ArsGeek.


Contact the author

6 Comments For This Post

  1. Marco Says:

    Hi,
    this is not true for all distro es Suse require root password also in init S; you must have the 1st installation cd, if i remember well ;-) .
    I like your blog
    Cheers
    Marco

  2. Bert Says:

    So everyone can just change the root password of my computer? Doesn’t sound very safe to me.

    But I do like your blog :-)

    Bert

  3. arsgeek Says:

    Hey Marco,

    You’re correct!

    Bert, it’s something of a failsafe. That’s why you’ve not only got to watch out for crackers, but social engineers as well.

    “Hi, I’m here to check the AC in your server room”. :)

  4. kobewan Says:

    Can’t you also do this (in Ubuntu) by choosing the “recovery mode” option in the GRUB menu? I believe that that boots into single user mode as well, although I’m not sure.

  5. albert Says:

    Not true. My system, continues to ask me for a password, a root password in this case, which is why i tried the single mode in the first place. Debian Etch is what i am using. Any ideas on how to clear it? The machine cant boot from cd, usb, nor floppy. Any other idea than pulling out the hard drive and pluggin it into an external case and installing from scratch using another machine?

  6. arsgeek Says:

    Hmmm Albert,

    You could try getting a live CD or something along the line of Knoppix and editing the /etc/shadow file.

    You may be able to get around it that way.

1 Trackbacks For This Post

  1. Mighty Linuxz » Forgot your root password? No problem, just reset it. Says:

    [...] read more | digg story [...]

Leave a Reply