Sometimes and for many reasons we may forget/loose a user password…
If it was a Standard/Managed account but you still have access to your Administrator account, it’s pretty simple to solve, and you only have to go in System Preferences > Users & Groups, click under the desired user at the list then click Reset Password…
Now, if you lost your Administrator password… Well, it’s a bit more tricky to solve…
First you’ll need to start the system in Single User Mode, use one of the options below;
A. Real Macs = Power On the computer while holding Command+S keys.
B. Hackintoshes = Add the boot flag -s to your boot loader.
By choosing any of the options above, you’ll see a screen similar to the image below;
1. Run the two commands below, each line at once followed by RETURN (Enter);
# fsck -fy
# mount -uw /
2. Now, you have to use the command passwd followed by the user account’s name to set a new password for this account, for example, let’s set the password of the user forgotten (remember you should replace forgotten for the target username);
# passwd forgotten
Then you’ll have to type the new password, press RETURN (Enter), retype the password and press RETURN (Enter) again…
3. After this run the following command to reboot;
If everything went well, you should be able to login again to your account, but if no, there’s one more thing you can try to do…
1a. Repeat the Step 1;
2a. Run the following command to make OS X “believe” that you have an “fresh new” installation and will bring to you the Welcome Screen giving to you the ability to setup a new user;
# rm -rf /var/db/.AppleSetupDone
ATTENTION:If you have important data at the old Administrator account DO NOT use the same name, instead, choose a new one.
3a. Run the following command to reboot;
After this, you only have to log in to this new Administrator account and you’ll have full access again to all files and folders of any user.