Text input management may affect authentication
If passwords are not being accepted at some prompts in OS X, a text manager program or similar service may be interfering.
When using your Mac there may be times when you might need to input a password or two, either for a local service like authenticating a system settings change, or a Web-based one such as logging into a banking Web site. While these services ought to accept your passwords just fine, if you have a third-party text management program installed, you might run into troubles with how some passwords are handled.
For example, such errors may show in which passwords are accepted just fine in system authentication prompts, but when you supply passwords in the OS X Terminal, they may no longer work, and instead result in persistent "Sorry, try again" errors, even though the password is quite definitely entered correctly.
If such issues happen, sometimes it can indicate a severe corruption with the authentication routines in OS X, which can be concerning since it means an account may need to be rebuilt, or perhaps OS X needs to be reinstalled. As it turns out, with text management tools like TextExpander installed, the program by default may try to automatically capitalize the first letter in words deemed to be the first in a sentence, which thereby prevents some passwords from being entered properly if they begin with lower-case characters.
Therefore, if you find yourself unable to authenticate on a system, first be sure that an automatic text-handling program or similar service is not interfering. While you can simply disable these that you know about, you can also try some options to test whether the password problem is rooted elsewhere.
For online services, you can try using a different browser, loading a browser in a second user account, or even using a separate system altogether. These will respectively test if there is a browser-specific configuration contributing to the mishandling of the password, or if there is a global service installed on the system that is affecting the password. If multiple browsers (especially on different systems) give a password error, then the problem is likely with your online account and not with the local system.
For local services such as authenticating at the system preferences, you can also try authenticating using another account's credentials, or even do so within another account to avoid any background processes you might have running in your account. If successful, and if you cannot seem to use your password at any other prompts, then try changing your initial account's password to see if a basic reset helps, and use a simple password like 12345 to test (be sure to change this to a more complex one later on). Changing the password will cause the directory services to update and rewrite your account's configuration, which may spur it to work properly.
If you are only experiencing the problem when using the Terminal, you can try another Terminal interface, such as xterm or iTerm2, which may handle input differently. However, you can also try enabling Remote Access in the Sharing system preferences and logging into your system using SSH to see if your password is accepted properly. This will use the same local authentication, but will use a separate input method. If unsuccessful, the problem is likely not with a local input or text management service, and instead is likely an error in the account itself.
To fix such errors, if a basic password reset does not work, you can try rebuilding the account altogether. To do this, go to the Users & Groups system preferences and delete the problematic account, and choose the option to keep the home folder in the Users folder. Then click the plus button to create a new account, and supply the same username and password. Make sure the "short" username is the same as the home folder of the deleted account, and the system will ask you whether to use the existing folder as the home folder. When finished, the directory and authentication information for this account should be completely rebuilt, and it should allow you to authenticate again.