Recover forgotten iPhone root password

Category: 
Tutorials
Tags: 
iphone
If your like me and changed your root password for security reasons after reading about exploits to Jailbroken iPhones, then you may have forgotten what you had changed the password to. Our objective is to get root write control to the file system so you can change the root password in /etc/master.passwd back to something that you know. This should be simple as all apps run as root. We do this by first installing iFile.
  1. Open up cydia
  2. Wait for it to do that "Loading data" bit and hope that it's loading something more than 'home' because you're just going to go straight to search.
  3. Search for a package called iFile.
  4. Install iFile.
  5. Once iFile is installed close cydia and open up iFile.
    iFile lets you browse, open, and maipulate files. This includes moving them.
  6. In iFile browse to the /etc directory (top left a few times, then find 'etc' and tap that).
  7. Once in /etc/ scroll down and tap on the file called 'master.passwd'.
  8. Select Text Viewer in the screen that pops up, then click the edit button.
  9. find the line that looks like root:UlGASB5XWDrOc:0:0::0:0:
  10. The part we need to edit to change your devices password is between root: and the first :0
  11. Next you want to generate a new password hash. You can do this with the perl function 'crypt'. If you've no idea what that is head over to Crypt Tool online . At that website you see a large text area with $str above it, and a one-line text input with $salt above it. $salt can be any two characters. In $str will be where you type your new password, go ahead and do that, and salt. Next click run.
  12. You should get a result like what you previous hash was, it should be without any special characters.
  13. Replace the text between root: and the first :0 with your generated hash. Be careful to copy it exactly.
  14. Click the Save button at the top of iFile screen, then Click the Done button.
Congratulations you successfully rooted your iPhone and changed the password (wasn't exactly hard was it).

Feedback

Thanks so much!

Submitted by Lost boy on November 28, 2010 - 4:35am

thank you !

Submitted by dsfsd on January 6, 2011 - 3:49am

What do one do when the master.passwd file is empty?

Submitted by Holbek on March 10, 2011 - 12:40am

What version of iOS do you have on your phone?

Submitted by Brian Gilbert on March 22, 2011 - 11:34am

what should i put in $salt?

Submitted by waichun on March 28, 2011 - 1:12am

$salt can be any two characters.

Submitted by Brian Gilbert on April 18, 2011 - 7:10pm

thanks! worked great!

Submitted by teo on April 20, 2011 - 7:54pm

Thanks for the tutorial, but I can't seem to get it right. The only difference I see in my scenario is that there is a forward slash right after "root:", the 13 characters that have to be changed, and then on with the :0, etc. I tried both leaving and removing the "/" to no avail. I am trying to log in via FTP and can't get in. I am on an iPhone 2G running 3.1.3. Thanks for any help you can give.

Submitted by Scott on May 12, 2011 - 6:31am

Thanks!!!!!!

Submitted by ANF on June 27, 2011 - 11:36pm

Thanks so much! This worked like a charm.

Submitted by Will on July 2, 2011 - 6:45am

Hi i did what you said but when i log in with su in mobile terminal it still says wrog password am i doing something wrong? please email me please michael_viteazul@yahoo.com

Submitted by Michael on October 19, 2011 - 5:00pm

That is just excellent. You have provided some very usefule information here for us, thanks.
<a href="http://www.recover-deleted-iphone.co.uk">Recover deleted Iphone Messages</a>

Submitted by Tom on October 25, 2011 - 1:25am

<a href="http://www.recover-deleted-iphone.com">Recover deleted iphone messages</a>

Submitted by Tom on October 26, 2011 - 12:46pm

Does this work on 4s?
Thanks
<a href="http://www.itsupportcosts.co.uk">ItSupport Costs</a>
Tom

Submitted by Tom on November 24, 2011 - 5:00am

Thank you so much. it's work on iOS 5.0.1!

Submitted by Saeid on April 17, 2012 - 10:35pm

Thanks this work,,
Great for you!!!

Submitted by Rifki on June 6, 2012 - 3:56pm

Followed the steps, two times, even rebooted, still no joy... Ipad2 iOS 5.1.1

Submitted by Fox on November 3, 2012 - 2:58am

I can't open my iPhone as I forgot the root passwd, so how to detect it? Plz guide me

Submitted by Lobsang on September 14, 2013 - 3:42pm

Still works! Thanks!

Submitted by mithralender on October 14, 2013 - 3:16am

It does not work on IOS 7.04. Help!

Submitted by Paul Zane on January 28, 2014 - 9:32pm

Iphone 5 ios 7.0.4, changed it in ifile rebooted and now cydia and ifile will not open and i cant seem to get to root using any of the other apps like idocs etc

Submitted by Justin schell on March 26, 2014 - 3:21am

5mg viagra
<a href=http://genericviagra-usa.com>generic viagra
</a> viagra erythromycin interaction effect
- generic viagra

Submitted by Narledis on April 9, 2014 - 6:46pm

Add new comment