Recover a Lost Password On Mac OS X ( Lion Included )

Hacking is the (unethical) act of using a computer to gain unauthorized access to a computer. Password Recovery is regaining access to password that you may have lost or forgotten to gain access to - in this case - your computer. But there are some cases when one is not so different from the other.

1331830327 decrypted

Recovering a Mac's password is one of those cases. Most Mac users, or computer users, tend to have a password to protect their confidential data. Generally, people set a password that is not too obvious and often quite long and complicated. I too am guilty of that. So when we forget such a password, we have one last hope left: Praying that Apple has in place for people like us a system to regain access to our beloved data. Now naturally, I wouldn't be writing all this if I wasn't going to tell you how to do it, so here it is.

Lion OS icon2

For Lion or Previous Versions of OS X

This is for users of Mac OS X Lion or previous versions of OS X which includes Snow Leopard, Leopard, Tiger, etc. (Mac OS 10.7 or less)

1. Single User Mode

The first step is to reboot your Mac in Single-User mode which gives you root access to the computer. So restart your Mac, and while doing so, hold down command-s. You should now see a black screen with white text on it.
2. Type in the Code
Now that we have a black screen with text on it, its pretty evident what we have to do. We type. So here's what you have to type:

/sbin/mount -uw /
rm /var/db/.applesetupdone
reboot


Note: Make sure everything is exactly as typed above. Also, after each line, press return or enter.
What we did: The first line basically mounts your hard drive, so that you can now edit the rest of the stuff. The second line gets rid of the Apple setup file. Apple uses this file to check if the Mac has a user set up or not. The logic behind it is quite simple - If the file is missing, the Mac doesn't know if a user account has been setup or not. So it starts up as though its a new mac. That is, it sets up a new account. A new administrator account. The last line simply reboots your computer to do the aforementioned task of setting up a new Account.
3. Set it Up
Now all you have to do is watch the video and complete the set up process. If you don't remember, it's quite basic. Name, username, password, etc.
4. Delete the Old Account ( Or the New One )
Screen Shot 2012 03 15 at 10 26 37 PM
If you want to use the new account, then you should probably delete the old user account. Go to System Preferences --> Accounts. Click on the old User Account name (you may have to authenticate first) and press the little minus button at the bottom of the window. Now, you'll need an administrator account and password. So type in your new account name and password (must be exact). You should probably save the contents of your old account. (Apple will ask you what you want to do with them)
If you want to use the old account, go to System Preferences --> Accounts. (you may have to authenticate first) Now click on the old account's name from the list on the left and click "Reset Password". Once done, delete the new User by using the above mentioned process.