Mac OS X Password Recovery

Instructions for the Mac OS X Password Recovery.

Although there’s no real way to recover a lost root password, you can change the root password even if you do not know the current one. You must have physical access to the machine in order to accomplish this task.

1. Click Restart at the login window

2. While the computer is restarting, hold down “Command-S” until you see text scrolling through the window. This boots the computer into single user mode.

3. At the Localhost% prompt type:

/sbin/fsck -y
/sbin/mount -uw /
/sbin/SystemStarter

You will then see various services starting up.

4. When the Localhost% prompt reappears, type:

passwd [username]

It will then ask you to type the new root password twice, so do so.

(Though I’ve not tried it, it appears you can type niutil -list . /users to get a list if users if you do not know the username….if someone wants to verify this, I would be most appreciative).

5. After entering the new password, type:

reboot

6. At the login window, enter the username with the new password. Once you are logged in, you can use the Multiple Users application (/Applications/Utilities) to change your user’s password, or create a new user account.

Note: this may not work for newer versions of OS X; I think they did something about it in a security update.

130 Responses to “Mac OS X Password Recovery”

  1. Z. D. says:

    You don’t need to be on the net to do it. Type a command and press enter (return) to have it ran.
    #: or something like [localhost #] means it’s ready to accept input after Single User Mode is activated. Also, just so you’re aware, these are just shell commands, not actual “code” perse. Good luck.

  2. KNARZ says:

    confirm of working…

    that works!

    “/sbin/fsck -y”
    “/sbin/mount -uw /”
    “/usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d”
    “cd /var/db/netinfo”
    “netinfod -s local”
    “SystemStarter”
    “passwd root”
    “reboot”

  3. Tony Davey says:

    I upgraded from Panther to Tiger on my powerbook G4. It started hanging, mostly on mail. This afternoon it hung and I powered off the machine. When it restarted it brought up a login screen, which I had not configured. I have followed the instructions above, but when I get to “/usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d” the screen goes back to the localhost:/ root# prompt for a second and then I get the following message and I’m left with a non flashing cursor and I have to power off again:

    May 9 22:06:09 com.apple.SecurityServer: database /var/db/CodeEquivalenceDatabase opened READONLY (R/W failed errno=30)
    May 9 22:06:09 com.apple.SecurityServer: error writing entropy file /var/db/SystemEntropyCache
    May 9 22:06:11 launched: Server 3907 in bootstrap 1103 uid 0: “/usr/sbin/securityd”[1031]: exited abnormally: Abort trap
    UninEnet: Ethernet address 00:0d:93:3c:38:10
    May 9 22:06:16 launchd: Server 0 in bootstrap 1103 uid 0: “/usr/sbin/lookupd”[1071]: exited abnormally: Hangup

    Nightmare! Supposd to be on a train to London in 8 hours

  4. LokiSnake says:

    Tony Davey:
    Well, I have Tiger and but I cannot really help you. Maybe try macaddict.com/forums and ask there. Those guys are usually quite friendly and helpful.

    I strongly recommend doing Archive and Install or even Clean Install for OS upgrades, since those cause the least problems, and with Archive and Install, it actually renames your System folder to Previous System, installs a clean System, keeps your Home folder and almost everything else intact, other than the other components that need updating.

    ‘niutil -list . /users’ (without quotes) does work

    And, as a warning, it is most safe to not enable the root account. If you have to run anything as if you are root, just type ‘sudo command‘ it’ll ask you for a password, then it’ll run the command.

  5. Dan says:

    I don’t get “Localhost%”

    I get Localhost:/ root#

    Is this the same thing?

    I can follow all the steps up to

    —–
    4. When the Localhost% prompt reappears, type:

    passwd [username]
    —–

    I have typed those exact letters. I have typed “passwd [Joan]” and “passwd Joan”

    None of those things has resulted in the computer asking for a new root password.

    Any help?

    Thanks,
    Dan

  6. jey says:

    I tried. I typed what you said at the localhost:/ root# prompt after that it just keeps on repeating waiting on apache server. What do I do about that?? can some answer this question is the same that i gad

  7. ibizamale says:

    hiya all. i have the same problem as milan above

    the systemstarter completes then:::

    Startup complete.
    2005-03-29 18:33:56.336 open[200] LSCopyItemInfoForURL() returned -35 for path /System/Library/CoreServices/ARD Agent.app
    2005-03-29 18:33:56.655 open[200] Couldn´t open file: /System/Library/CoreServices/ARD Agent.app
    2005-03-29 18:34:04.755 open[222] LSCopyItemInfoForURL() returned -35 for path /System/Library/CoreServices/ARD Agent.app
    2005-03-29 18:34:04.774 open[222] Couldn´t open file: /System/Library/CoreServices/ARD Agent.app
    2005-03-29 18:34:12.923 open[223] LSCopyItemInfoForURL() returned -35 for path /System/Library/CoreServices/ARD Agent.app
    2005-03-29 18:34:12.942 open[223] Couldn´t open file: /System/Library/CoreServices/ARD Agent.app

    appears and the system crashes – i have followed your steps any ideas

    cheers

    Liam

  8. Anonymous says:

    so yea the trick of loading the mach stuff works out great on 10.3.5 i am loving this .. this is the first day i have ever owned a mac i bought it from a school and didnt get the password or OS disk.. lolz so i was not doing well without the sysop password.. hooray for my linux expierence .. made it much easier

  9. Anonymous says:

    Instructions worked fine on Tiger for me too. Two caveats: on register_mach_bootstrap_servers, I also got lookupd exiting abnormally “:Hangup” — just ignored; also, netinfod never brought me back to a command prompt — was a little worried at first, but I hit Ctrl-Z to suspend, then typed “bg” to run the suspended thread in the background, then continued w/the instructions (ran SystemStarter). Guess that Linux background comes in handy :-).

  10. Anonymous says:

    Hey we love you Baxter thanks for thr hint that is super!

    Maude & J

  11. Anonymous says:

    Hi is that system good for G4? David, [email protected]

  12. Anonymous says:

    Hi it’s Giunia, I tried your hints but apparently it’not working: after I type the new password, my mac replies ‘Sorry’. Then if I reboot no pw has been changed apparently.

    has any of you experienced this? is there a hint I could try?

    thanks a lot.

    from france,
    giunia

  13. Anonymous says:

    the original advice worked great for me.. running osx 10.0.3

  14. Anonymous says:

    Massimiliano

  15. Anonymous says:

    My Mac OS X was a version 10.4 and now it is a 10.2. The screen is half the size it should be in a smaller size. I need to get the version 10.4 back so that everything will be working all over again. If anyone can help me please post the solution on here. Thank you.

    megann from North Carolina

  16. Anonymous says:

    i ran the following:

    # /sbin/fsck -y
    # /sbin/mount -uw /
    # /usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d
    # cd /var/db/netinfo
    # netinfod -s local
    # SystemStarter
    # passwd root
    # reboot”

    however, the root passwd – while no error message was returned – was still not changed the next time i logged in. please let me know if there may be something else i should do. i’m running 10.3.7 on PowerPC G4.

    thanks much!
    elise
    [email protected]
    eliselinn.com/

  17. Anonymous says:

    Hello, i have just got a ibook of e-bay but it came with no cds and it is asking for a passwd, the seller is not answering me so I have done what you said abot changing the passwd. It let me change the passwd using:
    passwd -i file -l /etc/master.passwd root
    But what do i do now, i am new to Mac only had the ibook for 8days. It is runnig 10.3.7 if that helps :-)
    Thankyou for your help!
    Winblows convert

  18. Anonymous says:

    Hi there,

    Everything works fine until the end where I have to enter a new password.

    After I enter twice it gives a “Sorry”

    I tried rebooting it then entering the new password but it does not work..

    Any help would be great thanks ..

    Brad

  19. Anonymous says:

    please help with my password change

  20. Anonymous says:

    stuart

    Have read all of the above but the g4 pbook says that the local is journaled

    what does this mean.

    if you can help i would be greatfull as the this is *****ind me off

  21. Anonymous says:

    hey brad i have the same problem any luck or find anythint else?

    RD

  22. Anonymous says:

    my hd is unmount
    and i got this message
    Invalid B-tree node size
    Volume check failed.

    what should i do

    [email protected]
    [email protected]

  23. Anonymous says:

    A client’s laptop is running MAC OS X9, they have forgotten/set there password accidentally… i need to recover it, but the laptop only comes up with Shutdown, no restart…

  24. Anonymous says:

    ok i try to change the password in the new password place and i type it in and it just skips to retype password and then it says mismatch try again can someone help me

  25. Anonymous says:

    !Please!
    I made some changes with boot for my mac. So now it works just under a single-user mode. how to back it to standart mode?