Recover forgotten iPhone root password

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).

    Post new comment

    The content of this field is kept private and will not be shown publicly.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    More information about formatting options