geekvenue.net

Welcome to Chucktips Hardware HELP WITH DEAD OS Installing FreeBSD Miscellaneous
 faq
 search
 add article
 cool-stuff
 how-to
 main
 tips


HOWTO: Recover lost root password
HELP WITH DEAD OS Posted by Jason on Friday October 05, @01:31PM
from the got-root? dept.
Got root? Or more to the point forgot root?

I think we all know what a terrible feeling it is to be locked out of our home or auto. It's even worse when you have forgotten the root password to your unix box.

No need to worry. It can be recovered.

In order to recover your root password, you must boot FreeBSD in single user mode, mount the filesystems read/write and issue the passwd command. The passwd command will not actually recover your root password, but will allow you to change it to something new.


[Boot in single user mode]

As the operating system is starting, it will display the following message:

Hit [Enter] to boot immediately, or any other key for command prompt.

Booting [kernel] in 10 seconds...


You should now press the space bar, and you will see the following message:

Type '?' for a list of commands, or 'help' for more detailed help.

ok


Now type boot -s and press the enter key to start FreeBSD in single user mode. After the system boots, you should see the statement:

Enter full pathname of shell or RETURN for /bin/sh:

Press the enter key and you will have a # prompt.


[Mount the filesystems]

At the command prompt, issue the mount command. This command will mount all the filesystems listed in your /etc/fstab file.

# mount -t ufs -a


[Change the root password]
Issue the passwd command and you will be prompted to enter a new password for the root account.

# passwd

New password:_
Retype new password:_
passwd: updating the database...
passwd: done

# exit

There is no need to reboot the operating system to go to multi-user mode. The exit command will cause the system to return to multi-user mode without a reboot.



To learn more about the passwd command and other commands, refer to their man pages:
man passwd
man mount
man exit


<  |  >

 

Related Links
  • Articles on HELP WITH DEAD OS
  • Also by Jason
  • Contact author
  • ThinkGeek

    Sponsors

    The Fine Print: The following comments are owned by whoever posted them.
    ( Add a Reply )

    Over 10 comments listed. Printing out index only.
    Re: HOWTO: Recover lost root password
    by asdf on Thursday May 30, @07:57AM
    when tried to run mount, it said mount not found, tried to run /sbin/mount -t ufs -a, it said the /var and /usr filesystem is not clean, can't mount read/write. please advise what to do in this situation... thanks!!!
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by pato on Thursday December 12, @12:44PM
    Does any one know - will the above method work on Mac OSX (10.1.2)? thanks!
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Dan on Tuesday February 11, @04:35AM
    Re: OSX - here's a page on how to do the same thing in OSX: http://oit.utk.edu/macvolplace/oldnews/200208.php
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by whatever on Monday February 17, @09:26PM
    I tried all mentioned. Mount: not found no matter what.
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Strungle on Monday April 28, @07:05PM
    WORKS FINE!!!!! TKS A LOT!!!
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by vick on Thursday May 01, @02:27AM
    and what if the console has been set to insecure in /etc/ttys ? i couldn't find help anywhere for this complicated situation.
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by tushar gohil on Tuesday June 17, @02:10AM
    thanks buddy i got my root access back but when i type #mount -t ufs -a its show me some error so i use fsck and after that i am able to chang root pass smoothly
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Vinod on Friday September 19, @09:15PM
    Hi Jason,
    Can u help me out to recover the lost UNIX password in AIX 4.2/4.3 for RS6000 server.
    If u could provide steps to do this then it'll be a gr8 help for me.
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Alejo S on Friday October 24, @08:18AM
    your doc is great, but a little change I suggest: tell ppl to do fsck -y to handle unclean filesystems. cheers
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by harold miller on Saturday May 14, @03:17PM
    thank you. thank you. thank you. thank you. thank you.

    harold
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Lisa on Saturday June 24, @05:00PM
    This Tip was Great! What a time saver! Thanks!! :-)
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by venom on Friday June 30, @04:34AM
    thanks a lot! easy to follow and to the point... it just took me a sec to login a root again!
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by JillB on Wednesday October 18, @07:27AM
    Jason, I am trying to bring up a Sun Ultra-2 that nobody has the root password to. The first thing I see is 'Initializing Memory'. Please help. I have been trying to get information to get into our own machine for weeks. We have no service contract or boot disk. Sun won't talk to me unless we give them a PO for $2500! Jill
    [ Add a Reply to this ]
    Re: HOWTO: Recover lost root password
    by Bob on Sunday June 17, @08:45AM
    I tried this. But when I attempted to mount the root filesystem r/w, I received an error that stated something to the effect that I needed to run fsck. I believe that error was due to improperly shutting down. When I had been in my normal account, and tried to su but couldn't remember the password, I was forced to turn off the computer. So I ran fsck, it stated that there was some obscure error, did I want to try to recover, which I replied "y". It was not able to recover that particular error, but the command as a whole completed. I then was able to mount the root file system can continue as your directions indicate. Bob
    [ Add a Reply to this ]

     
    The Fine Print: The following comments are owned by whoever posted them.
    ( Article Reply )

    "You never know how many friends you have until you own a Condo on the beach." -- Jason's Postulate

    Powered by Zope  Powered by Apache  Squishdot Powered
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©2001 Jason Neumann.
    [ main | post article | search ]