Solved

Forget root Password

Posted on 2004-04-12
7
1,110 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

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
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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