This is a Hack that is quite dangerous if you have lost your Mac and someone is trying to use your account and its content. On the other hand it is very useful if you have forgotten your password.
Important Note: If your Mac OSX password is tied to the Apple iCloud account then this trick might not resolve your situation and you might have to go through the procedure of resetting your iCloud/Apple ID password via Internet.

Here are the steps: