We had shared tips on how to reset forgotten iPod screen-lock code and iPod volume lock PIN, if you are facing the same problem with your iPhone or iPod Touch until recently you were out of luck as the only option was to do a fresh restore but now new utility RMPassword lets you reset your iPhone lock passcode easily on a MAC OS X.
To get your iPhone lock code resetted follow the simple hack as described next, for this to work your iPhone must be jailbroken with Wi-Fi connectivity and should have OpenSSH installed.