Forum     

Go Back   Digit Technology Discussion Forum > Community > Tutorials
Register FAQ Calendar Mark Forums Read

Tutorials This section offers tutorials and How to's on just about anything related to computers and IT. Note: All tutorials are courtesy the posters and not verified by Digit


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-07-2007, 02:27 PM   #1 (permalink)
Geekologist
 
piyushp_20's Avatar
 
Join Date: Dec 2006
Location: Udaipur
Posts: 140
Default Recover Root password


A common problem faced by new users ( and sometimes even experienced users ) is not knowing what to do when they lose their password. Even worse, when they lose the password for 'root'. Luckily, there are several solutions to help you recover access to your system.

Root Password - Easy Method:

The simplest way to recover from a lost password is to boot into single user mode.

If you are using LILO, at the LILO boot prompt (graphical LILO users can press Ctrl-x to exit the graphical screen and go to the boot: prompt), enter:

Code:

linux single

This will make you the "root" user without asking for a password. Once the system has booted, you can change the root password using the password command:

Code:

passwd
The instructions for GRUB users are similar. Press 'e' at the GRUB prompt to select boot parameters. Select the line for the kernel you want to boot, and go to the end of it. Add "single" as a separate word, and then press ENTER to exit the edit mode. Once back at the GRUB screen, press "b" to boot into single user mode.

If for whatever reason, the above solution doesn't work for you, there is another option. Boot using a so called "Live CD" Linux distribution, such as Knoppix. For the purposes of this example, it will be assumed that the user is using Knoppix.
After booting up from the Knoppix CD, go to a terminal and su to root (no password is required). After your priviledges have been escalated, issue the following commands (be sure to replace each /hda1 with your own root ('/') partition):

Code:

mount -o dev,rw /mnt/hda1 cd /mnt/hda1/etc

Once you are into your system /etc directory, you can use a text-editor (such as vim, nano, pico, etc.) to edit the /etc/shadow file where the password is stored. Various information about root and user accounts is kept in this plain-text file, but we are only concerned with the password portion.

For example, the /etc/shadow entry for the "root" account may look something like this:

Code:

root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:/
10852:0:99999:7:::
(The '/' indicates a line continuation)


Now, using your favorite editor (I'll use vim) delete the password hash (the green text).

Code:

vim shadow

After you've edited this field, it should look like this:

Code:

root::10852:0:99999:7:::

Now save the file and change back to the root directory and unmount the system root partition (don't forget to change the /hda1) as follows:

Code:

cd / umount /mnt/hda1

Now reboot the computer.

Once the computer has booted and you're at the login prompt, type "root" and when asked for the password just press ENTER (entering no password). After a successful login, you need to set the new password for root using the following command:

Code:

passwd


source: Linuxforums.org
__________________
Piyush

Last edited by piyushp_20; 05-07-2007 at 05:58 PM.
piyushp_20 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 05-07-2007, 02:58 PM   #2 (permalink)
Microsoft MVP
 
Vishal Gupta's Avatar
 
Join Date: Jul 2005
Location: AskVG.com
Posts: 5,173
Default Re: Recover Root password

I think u forgot to mention the source:

http://www.linuxforums.org/security/..._password.html
__________________
:arrow: http://www.AskVG.com/
Vishal Gupta is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
forgot root password cyberzook Open Source 7 06-07-2006 07:10 AM
Root password ra_sriniketan Software Q&A 4 15-11-2005 12:58 PM
Root password godsownman Open Source 5 01-08-2005 03:38 PM
Root Password godsownman Software Q&A 5 13-07-2005 08:59 AM
FORGOTTEN ROOT PASSWORD cool_techie Open Source 6 23-03-2005 11:27 AM

 
Latest Threads
- by Who
- by Krow
- by clmlbx
- by Tech&ME
- by icebags

Advertisement




All times are GMT +5.5. The time now is 08:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2