Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-09-2003, 02:33 PM   #1
Registered: Nov 2003
Location: Tulsa, Ok
Posts: 121

Rep: Reputation: 15
Unhappy Lost Root password

I lost my root password and can't log in, i try to use the rescue option on my red hat cd but what is the command to switch to root from the rescue option?
Old 12-09-2003, 03:00 PM   #2
LQ Guru
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Booting into rescue mode
Old 12-09-2003, 04:14 PM   #3
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
the rescue cd gives you root power right away... "boot access is root access"...

what you need to do is get the system to boot into "single user mode"...

you do this by editing the file "/etc/inittab" (using the rescue cd)...

there will be a line like this in there:


or maybe (if you're booting into X)


you want to change that to (from the rescue cd):


and then restart into your regular linux, it'll go right to a command line with full root privilages... then you should be able to assign a new password without knowing the current one, and after you do that, just edit the inittab back to the way it was (you won't need the rescue cd to do this now) and reboot...

good luck!
Old 12-09-2003, 07:44 PM   #4
Registered: Nov 2003
Location: Tulsa, Ok
Posts: 121

Original Poster
Rep: Reputation: 15
sweet thx for the help guys
Old 12-10-2003, 12:21 AM   #5
Registered: Dec 2003
Posts: 33

Rep: Reputation: 15
Just FYI, you don't even need a rescue CD etc.

When you boot and see the kernel prompt:
You passed the argument "init=/bin/sh" to the kernel.
Linux: linux init=/bin/sh

After booting the kernel, a root shell is started (instead of init that starts all the processes etc.)

Remount / as read/write:
mount -o remount,rw /
You may want mount other partitions with:
mount -a

Change root password:

Old 12-10-2003, 02:01 AM   #6
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
having your bootloader set to "prompt" you is a major security risk...


so unless you want to give ANYBODY that uses your box the power to do ANYTHING to it, it's recommended that you disable any "boot prompts" you might be getting from your bootloader...

then you know the only way to circumvent the system is to boot the box from a cd (rescue, knoppix, or whatever)...

but of course you configured your bios (and password protected it) to ONLY boot from the hard disk...

so now the only thing a malicious user (that wants to secretly OWN your box) would have left to do is to bust-out a screwdriver to open your case and reset the jumper to clear the bios configuration and it's password so he or she can then boot the cd...

but of course by then the SWAT team would already have the whole place surrounded and illuminated with green laser beams...


# You can set a password here, and uncomment the `restricted' lines
# in the image definitions below to make it so that a password must
# be typed to boot anything but a default configuration. If a
# command line is given, other than one specified by an `append'
# statement in `lilo.conf', the password will be required, but a
# standard default boot will not require one.
# This will, for instance, prevent anyone with access to the
# console from booting with something like `Linux init=/bin/sh',
# and thus becoming `root' without proper authorization.
# Note that if you really need this type of security, you will
# likely also want to use `install-mbr' to reconfigure the MBR
# program, as well as set up your BIOS to disallow booting from
# removable disk or CD-ROM, then put a password on getting into the
# BIOS configuration as well. Please RTFM `install-mbr(8)'.
# password=tatercounter2000
Old 11-29-2006, 04:03 AM   #7
LQ Newbie
Registered: Nov 2005
Location: Bombay, India
Posts: 5

Rep: Reputation: 0
Steps to recover root password

An outline of steps to recover root password in Linux:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost root password zillah Solaris / OpenSolaris 10 05-24-2005 05:28 PM
Lost root password amirdhagopal SUSE / openSUSE 13 02-10-2005 12:09 AM
lost root password papitu76 Mandriva 12 10-31-2004 10:40 AM
Lost root Password us06154 Linux - Newbie 17 08-14-2003 04:08 PM
lost root password dvong3 Linux - Newbie 2 06-13-2003 09:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration