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.
- Open up cydia
- 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.
- Search for a package called iFile.
- Install iFile.
- Once iFile is installed close cydia and open up iFile.
iFile lets you browse, open, and maipulate files. This includes moving them.
- In iFile browse to the /etc directory (top left a few times, then find 'etc' and tap that).
- Once in /etc/ scroll down and tap on the file called 'master.passwd'.
- Select Text Viewer in the screen that pops up, then click the edit button.
- find the line that looks like root:UlGASB5XWDrOc:0:0::0:0:
- The part we need to edit to change your devices password is between root: and the first :0
- 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.
- You should get a result like what you previous hash was, it should be without any special characters.
- Replace the text between root: and the first :0 with your generated hash. Be careful to copy it exactly.
- Click the Save button at the top of iFile screen, then Click the Done button.