Tuesday, May 5, 2009

Reset or recover admin password in Mac OS X

This is a lot easier than you'd think, and is more simple on a Mac than a Windows machine. There are a few ways to do this, and I'll cover them here. If you're looking for how to do this on a Windows machine, check out my other post.

If you're just looking to change your OS X user password, this can be done in the System Preferences. Open System Preferences, then go to Accounts. Choose the user you want to change the password of (yourself is the only option if you're not an admin) and click on Change Password. If you want to select a different user, you'll have to click the Lock icon in the lower left of the window and enter your administrative credentials.

Now, if you've just lost or forgotten your password for the computer, or perhaps a user left or was let go and you need to get in to their machine, there are a few ways to reset the administrative password. Those are covered below.

First, if you have the original OS X installation disk then you're able to use the easiest method. This method is even documented by Apple, and can be found here. The trick is to boot your system from the install CD, then use the built-in administrator password reset feature.

1. Put your OS X installation disk into the drive, then restart the computer
2. Hold down the C key while the computer is coming back on. This will force it to boot from the CD in the drive
3. You'll be presented with the initial language selection I believe, so choose your language and go to the next screen
4. You should see a menu across the top at this point. Go to Utilities, then Reset Password
5. Follow the directions to reset the administrator account password, then restart
6. Log in as that administrator and go back to using your computer

If you don't have the installation CD it's still possible to reset the administrator password, which is a bit of a security breach if you ask me. Anyway, this isn't much more difficult but does involve some command line entry. I've done it a few times with success. I couldn't remember the exact commands though, so I had to take them from here

1. Turn on the machine and hold down Command+S. Continue holding this down until the computer boots into single-user mode, which appears to be a command prompt interface
2. Enter the commands in the following order, pressing Enter after each:
mount -uw /
rm /var/db/.AppleSetupDone
shutdown -r now
If the machine doesn't shutdown and restart at this point, type exit and press Enter
3. The machine should restart. It may take a little longer than normal because it has to prepare the first-use wizard, but it'll be ok
4. Go through the first-use wizard to "setup" the machine again. During this process you'll be allowed to create a new administrator account. Don't worry, this process DOES NOT delete any of your files.
5. After you are finished with the first-use wizard you will get logged into the computer. Now you can go into System Preferences and use the reset password instructions from the beginning of this post to change the password of the account you want to access.

I've had success using single-user mode to reset passwords in OS X 10.4. However, I'm not sure if it still works in OS X 10.5. I did find another article that said it specifically worked in 10.5 only. If you're a 10.5 user and need those instructions, you can find them here.


No comments: