Solved

Forget root Password

Posted on 2004-04-12
7
1,113 Views
Last Modified: 2010-04-22
Hi to all...

I forget the root password, could I back to it without reinstalling?
I'm using Fedora Linux

Thanks
0
Comment
Question by:programmer_bmb
7 Comments
 
LVL 6

Accepted Solution

by:
karlwilbur earned 20 total points
ID: 10811056
It is not possible rto recover a lost password.

The easiest way to handle this that I know of is to reboot into single user mode or to a command line
Using lilo you'd do this:

lilo: linux single

or

lilo: linux 1

this may still require a password though,  if so try:

lilo: linux init=/bin/bash

if you're not using Grub instead of lilo, you'll have to edit the grub command from the boot menu to pass init=/bin/bash to the kernel.

Then from the command line type:
fsck /
mount -orw,remount /

then edit /etc/passwd and remove the password (making it blank).

root:I4ecBSBzgWj8Y:0:0::/root:/bin/bash
       ^^^^^^^^^  This is the password  (we'll not the actual password, it's kind of encrypted)

You might even see
root:x:0:0::/root:/bin/bash

in which case, delete the "x".  Just delete what ever is between the colons.

The fields in the /etc/passwd file are like the:
username:password:userid:groupid:/home/dir:/path/to/shell

-Karl
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10817731
After potentially remounting the root partition, you should be able to use the passwd command. There is no need to modify the /etc/passwd file with an editor.
0
 
LVL 1

Expert Comment

by:Sachin_Yash
ID: 10857742
HI !!!

       To recover your password just take down folloing steps...

      1. Restart your pc & on boot screen (either GRUB or LILO loader) just press 'e' you will see another screen where u just press again 'e' & after the given line which look's like
       " kernel /vmlinuz-2.... ro root=LABEL=/ "
           after one space insert '1' after '/label=' sign.
      2. Press enter & after u will again see the second page here u have to press 'b' & u will get superuser
prompt i.e.  
         sh-2.05b#

      3. Give command as
           sh-2.05b# passwd root
          linux will ask for new password ..just give it & your problem is solve...
          just reboot the computer....
      4. Select normal bootup & give modify root password...

       
0
 
LVL 2

Expert Comment

by:sam_sunder
ID: 10948196
hi

you can also boot with the cd and go to rescue mode.

you whole system will be mounted on mnt/sysimage (you will get a dialog box saying where it is mounted)

traverse to /etc/password.  at the root user remove * in the second field save the file and reboot. you can login without password. and then you can set the password by using passwd command.

regards,

sam
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12056219
Points to karlwilbur
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
openLDAP 10 132
kerberos passwd: Authentication token manipulation error 8 110
bad ownership or modes for chroot directory 6 175
wipe a usb using python 5 64
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Fine Tune your automatic Updates for Ubuntu / Debian
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question