Reset a lost OS X account password in single user mode

Last August I wrote a detailed article about the different ways to reset a user's password, however the instructions I gave for changing the password in single user mode don't always seem to work, especially in Leopard. Here is a new way to do it that should be more reliable.

Remember, only use this if you have lost the Mac OS X install DVD. Also, don't do this if you have FileVault enabled in your account, and note that this will not change your keychain password.

First, we need to restart in Single User mode. To do this hold down Command-S while the computer is starting up. A command line prompt should appear on the screen instead of the login window or your normal desktop.

At the prompt, type mount -uw / then return. Next, type
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
then return. You will need to type these exactly the same, so write them down beforehand.

The next step requires you to know the short username of the account. If you don't know this, type ls /Users followed by return, and look for it in the list that appears.

Next, type dscl . -delete /Users/username AuthenticationAuthority followed by return. Make sure you replace username with the short username of the account.

The final command to type is passwd username followed by return. As before, replace username with the short username of the account.

The rest is self-explanatory. Type the new password, followed by return. When prompted, retype the password.

Finally, type reboot and hit return! Your password should be reset.

blog comments powered by Disqus