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 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 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 🙂

6 responses to “Removing iPhone passcode lock”

  1. Works Great. Thanks. I used iPhoneBrowser and just deleted the files that he has listed here.

  2. Easy Peasy EXCEPT that killing the springboard would have some drastic effects. I say just go into keychain-2 to using a SQLite editor then go into gemp locate your device password then enter it in on your device or you could change it from there. OR use a hex editor (way easier) and locate the code and change it or do whatever you want. On SQLite editor find row 38. Hex editer Just look on the right For DeviceLockPassword or parts of that.

  3. I have a similar issue. I jailbroke my iPad on iOS 6.1.2, then put a passcode on that I have forgotten. I don’t mind losing all my data, I have backups, but I do want to keep it on iOS 6.1.2 so I can jailbreak again. I tried something called semi-restore hoping that it’d restore the iPad without changing the iOS version and remove the passcode. It did restore it, but it did not remove the passcode. It is sitting on the set up the iPad screen, but when I slide to set up it still asks for the passcode. I then found this and tried to use iExplorer to browse the file system to remove the passcode, but iExplorer won’t pick up the iPad, probably because it hasn’t been set up yet. What can I do?

Коментирай! 🙂