Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Forget root Password

Posted on 2004-04-12
7
Medium Priority
?
1,143 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
5 Comments
 
LVL 6

Accepted Solution

by:
karlwilbur earned 80 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

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

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

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Fine Tune your automatic Updates for Ubuntu / Debian
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

783 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