What happens if you forgot your iPhone passcode and cannot gain access? Perhaps a friend played a prank on you and changed your passcode, or more simply, applied one when you hadn’t been using one at all. You’re effectively locked out of your device with no means to regain access. The only solution for this is to connect to iTunes, put your device in recovery mode and restore it from a backup. Or is it?
In this article, I’ll walk you through restoring your device and resetting your iPhone password (and your entire device effectively), followed by how jailbreakers are again in luck in a scenario like this.
The Conventional Restore
A conventional method of dealing with forgotten passcode is to bypass the lock screen altogether, put your iOS device in recovery mode and restore to default, hereby losing all your precious data in the process (you can also restore from a backup).
![]()
Follow the steps below to restore your iPhone and reset the password:
- Disconnect your iPhone from the PC/Mac. Make sure iTunes is running on your computer
- Power off the device by pressing and holding the sleep button until ‘Slide to power off‘ appears.
- Press and hold the ‘Home’ button on your iPhone and while keeping in pressed, reconnect it back to the computer via USB cable.
- As soon as USB cable is attached, the phone should begin to boot. Keep holding the Home button until an alert message pops up, confirming the detection of an iPhone in recovery mode.
- In iTunes, select your iPhone and under the Summary tab, hit the Restore button.
By doing so, you’ll be restoring your iPhone to its factory state, hence removing everything including the passcode. From here on, you can either start fresh or restore from a previous backup, which hopefully you’ll already have.
Resetting iPhone Password Without Losing Data – Jailbreak Only
For jailbroken devices, the root access that comes along with a jailbreak can also be very useful in the case the user forgot the iPhone passcode. The process involves gaining access to the var/KeyChains root directory and deleting the keychain that holds the passcode information.
To achieve this, you’ll need a method of gaining root access into your device, either via wireless SSH or a free program like iPhone Explorer (I personally favor this). Please note that this method will require your device to be already jailbroken and OpenSSH installed if you plan on using wireless SSH. This method may also fail if your device was jailbroken using limera1n and you haven’t reinstalled the afc2add service.
The following steps utilize iPhone Explorer (download here) to remove the passcode lock on your iPhone or iPod Touch without losing data, for both Windows and Mac.
- Connect your powered-on device to the PC/Mac using USB cable.
- Launch iPhone Explorer and select Root Directory from the left hand pane.
- Navigate to var > Keychains
![]()
- Within Keychains, locate the one titled keychain-2.db. Right-click on it and Delete Selected.
![]()
- Disconnect your iPhone from the computer, power it off and power back on. The passcode lock would be removed without affecting your personal data or settings.
Did this method work for you? Found the tip useful? What do you do when you forget your iPhone passcode? Let us know through your comments and spread the word.
Jenny
November 4, 2011
HI Thank you for your post. I changed my passcode, thought I was sure I knew my new passcode. When I went to enter it, it didn’t work and my phone has been locked and disabled for 2 weeks now. None of the passcodes I’ve tried have worked so I’ve been looking into numerous ways how I can get access back to my phone. Yours seems the most helpful and easiest for me to understand. I was able to take all the steps with no problem, however when my phone turns back on it still has the passcode enter. Yes, my phone is jailbroken but since I didn’t do it myself, I’m not sure how to find out if it was done using the limera1n . If so, how do I reinstall the afc2add service you mentioned?
Valerie
December 15, 2011
Thanks for the awesome tip, but i do have one problem. Once i delete the file keychain2-db, it automatically keeps a backup file for it. And i’ve tried tonnes of time on deleting it and restarting my iphone, but it just doesn’t seem to work, my passcode lock is still there. Help me?
Jesse
December 22, 2011
Hey Valerie,
all you have to do is go to the iphonebrowser options ( in the edit tab) and turn on “no automatic backup”. you can either set it to do that for just that run, or every time you run the program. hope that helped
Valerie
December 26, 2011
Hey Jesse, thanks, but it didn’t work. i tried again, and again, but it just didn’t budge. i’m thinking of updating it to ios5,and then restoring it. will it remove all of my jaibroken apps?
Dino
January 28, 2012
Well It Resolved My Issue…..
I Didnt Forget My Passcode
A Jailbreak Theme Made It Impossible
To Type
When I Chose ” aio by krs ” & Hit Respring
The Keyboard Was tiny
I mean You Needed Baby Fingers To Use It
When You Hit “1″ 2,4,5 lit up also
So I Tried The Software at first I Had the same issue as Valerie
Then I Saw The Library Tab Went To The Themes Folder & Deleted The Bothersome Theme I Found Other Themes With The Same Lousy effect
But This Worked Like A Charm It Also allowed Me To Regain Precious Drive Space SIX STARS I Love It
h0re
February 6, 2012
I noticed some people are having the problem where the keychain reappears, so heres my fix, remove the key chain then remove //private/var/keybags/systembag.kb **WARNING** this will break your iphone putting it into restore mode but all you have to do is re-jailbreak your phone i use redsn0w and did’nt have a problem peace out
fuuuuu
May 30, 2012
Thanks alot h0re … i deleted my systembag and now that i try to rejailbreak i get “no successful frimware download after 60000 ms ! giving up” ….
I got iphone 4 5.0.1 jailbreak w redsnow 0.9.10b5c
And JESSE , i dont see the automatic backup thingie in edit…
d4rky
May 31, 2012
thnx bro …. worked awesome
vik007
June 12, 2012
Thanks a ton!! I had issue of password forgot and undergone the similar problem of Valerie. But **h0re** suggestion worked like charm. Thank You!!! by end of the day, going to bed happily after a days of struggle.
DNA64
June 23, 2012
I figured this would be a nice change vs using a custom Ramdisk, but as I suspected it didn’t work (iPhone 3GS 5.1.1). Maybe something changed in the latest build of Redsn0w but after deleting the systembag.kb file and running the jailbreak it just goes back into restore mode. Recovery Fix failed to resolve that issue. If I find a successful solution I’ll be sure to post it up on my blog. Cheers!
Erez
August 2, 2012
Hi,
did you find any solution to 3GS with 5.1.1?
Marco Pantaleon
July 21, 2012
why cant i delete the keychain thinggggg
Phindara
July 30, 2012
I cannot even go to iExplorer. what can i do? Please!
Ceedom
August 15, 2012
Im having the problem like valerie can someone pls help.
zas
August 15, 2012
i deleted the file and rebooted and the file return
Brendon
August 17, 2012
Deleted and the file still there .. after restart … stil need a passcode @@
Brendon
August 17, 2012
When i right click… it is not 2 options i has more than 2 options and none of it is delete selected . So how things going if it’s continue like that ?
Roro
September 10, 2012
i installed everything, went to keychain and wouldnt delete, i paid to have my iphone 3g jailbroken so i dont know whether its the limera1n thingi, what can i do, i need to get into my iphone !
Aiman
September 13, 2012
I did everything. It seems somehow can’t be delete when I click delete options.
iroot
October 27, 2012
Thanks soo much!! “h0re”
I had iPhone 4 CDMA iOS 6 with Jailbreak.
I just deleted 3 files using iTools software for windows.
/var/keybags/systembag.kb
/var/keychains/keychain-2.db
/var/mobile/Library/Preferences/com.apple.springboard.plist
then put on DFU mode and re-Jailbreak and then boot tathered.
IT works AWESOME!!!
all credits to: h0re !
Arzeluiz
December 24, 2012
i have an iphone 3g and wanted to know if there is a reason why my phone isn’t recognized by iphone explorer while on the lockscreen?
christie
January 30, 2013
is it normal for the kechain to take long when deleting becuz mine has been trying to delete the thingy for about 5 minutes by now please help me
christie
January 30, 2013
hello again please do not mind my last comment but i seem to have a bigger problem.. i permanently deleted the keychain but when i restarted it again, my iphone 4 was still disabled.. please tell me what to do
christie
January 30, 2013
also when i redid the process the keychain was there agian….i dont get it! maybe its becuz it was still disabled for 20 minutes but im not sure..please help me
Genevieve Teneza
February 18, 2013
Hello! I actually have the same problem as Valerie and I tried the suggestion of Jesse but the only buttons in my menu is file register help…….. But help me I have important files in my iphone which is jailbroken….. thank you in advance!!!