Removing iPhone passcode lock

Yesterday I had a few drinks and decided to put a passcode on my iPhone, just in case no one tries to crawl through it (stupid paranoia)… So I went on and put the passcode, typed it twice in the settings, set it to what I believed was the number I was typing and then locked the phone (power/sleep button). Then I tried to unlock it and it seemed that I managed to type a number twice without it being the number I wanted. So for the rest of the night I tried to figure out what was the number, but still no luck.

Now on a soberer head I found a way to remove the passcode lock (along with all other passwords on the phone though).

So the steps are as follow:

  • Go to the phone’s file system (linux is easy – check http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux-part-2/ on accessing ipod file system – same goes for iPhone and iPod touch).
  • Then head to /private/var/Keychains
  • Move the file named keychain-2.db to other location, e.g. /
  • Then head to /var/mobile/Library/Preferences/
  • Move the file named com.apple.springboard.plist to other location, e.g. /
  • Then you have to kill springboard ( killall SpringBoard if you are in through SSH) or just reboot the phone.
Voila, that’s all.
The side effect of this exercise is that you would loose all your passwords for mail accounts, exchange accounts and the order of icons on the springboard, but still you wouldn’t have to reflash the phone 🙂