1. matthew_exon's Avatar
    I don't know the root password for my phone so I tried editing master.passwd with iFile. After editing it several times, if I try running "su root" I get "su: user root does not exist". I assume this means somehow I accidentally broke that line of the file. "su mobile" works fine (although I don't know that password either).

    Now if I try running iFile it always crashes. So does FileBrowser. I'm guessing this means they try to become root, the OS objects, and they just crash.

    Can anyone suggest a way to recover from this?
    2015-04-06 12:59 PM
  2. bbrks's Avatar
    What kind of root password do you have on your iPhone, if I may ask???
    Last edited by bbrks; 2015-04-06 at 01:06 PM.
    2015-04-06 01:01 PM
  3. matthew_exon's Avatar
    I'm not sure I understand the question. It's the standard unix-style password for the root user, user ID 0.

    I was following instructions here:

    How To: Recover A Forgotten iPhone/iPad Root Password - iJailbreakthis

    ...and as it suggested I generated a password using this tool:

    test crypt online - cryptographic PHP functions - functions-online
    2015-04-06 01:15 PM
  4. bbrks's Avatar
    No, everything fine, just checking...
    2015-04-06 01:28 PM
  5. matthew_exon's Avatar
    Ha! That was a merry chase!

    I eventually built my own .deb file and put it on my own APT server to fix this. Cydia's package installer runs as setuid root but doesn't require the root password. But you can't just install a package off the filesystem, it has to be on an APT repository.

    The .deb file contains a postinst script which does the actual surgery on the master.passwd file. I had to run many iterations before I figured out what the problem was and I was comfortable with the fix. The problem was that I'd accidentally added a newline between "System" and "Administrator". So the postinst script looks like:

    #!/bin/bash
    cp /etc/master.passwd /etc/master.passwd.edit
    sed -i -e ':a;N;$!ba;s/System \n/System /g' /etc/master.passwd.edit
    cp /etc/master.passwd.edit /etc/master.passwd.edit.public
    chmod a+r /etc/master.passwd.edit.public
    cp /etc/master.passwd.edit /etc/master.passwd

    (The .public version is so that afterwards I can check to see if I screwed up again.)

    Then I made a control file like this:

    Package: mathack
    Version: 1.0-8
    Section: base
    Priority: optional
    Architecture: all
    Depends: bash
    Maintainer: Matthew Exon <[email protected]>
    Description: Hack to restore root user
    This script is designed to repair a broken master.passwd file

    I built it into a .deb using my Ubuntu machine:

    dpkg-deb -Zlzma --build debian

    The "-Zlzma" is important since Cydia seems to use an older compression format. Then I install it in a custom area of my APT repository:

    sudo reprepro -V -b /var/www/apt includedeb cydia mathack.deb

    After installing the file it fixes the master.passwd and now not only does iFile work again but I can su to root! Yay!
    2015-04-07 12:05 PM
LINK TO POST COPIED TO CLIPBOARD
We have updated our Privacy Policy and Terms & Conditions. Please check them out.