iPhone BSD Subsystem 2.1’s broken “su”

Date March 9, 2008

BSD subsystem 2.1 (and I think 2.0 too) for iPhone has a broken “su” binary. This is especially annoying, since the default user is now “mobile” and if you try to change to root using MobileTerminal, you get:

$ su
dyld: Library not loaded: libarmfp.dylib
Referenced from: /usr/bin/su
Reason: unsafe use of relative path libarmfp.dylib in /usr/bin/su with setuid binary
zsh: trace trap su

To fix the issue, copy the su binary to your Mac, run “install_name_tool -change libarmfp.dylib /usr/lib/libarmfp.dylib su” and copy it back. It should work now.

One Response to “iPhone BSD Subsystem 2.1’s broken “su””

  1. Chester said:

    Thank you VERY MUCH for this - in fact, I needed three steps to make sure su will work:

    a) your fix (must be done first, since copying back and forth may mess the flags below)
    b) make sure su’s SUID is root, that is:
    chown root /usr/bin/su
    c) make sure you have the right flags to allow it to do its magic
    chmod ug+s /usr/bin/su

    After that, an ls -la /usr/bin/su should give you somehting like the line below (except for the file size / date /t ime):
    -rwsr-sr-x 1 root staff 40104 May 25 12:12 /usr/bin/su

    Happy sudo-ing! :-)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>