Running my app as root?

Discussion in 'iOS Development' started by Ryan, Jun 13, 2010.

  1. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    Hi there I have a simple application that edits the

    /System/Library/CoreServices/SystemVersion.plist

    file, it works fine in the simulator and reads my macs version number as the name and it also saved it fine after setting the plist to read and write permissions.

    However when I use it on my iPod it will read the system version as 3.1.3 but wont write the changes to the plist.

    Ive set the permissions of the app to run as root but it still wont work and ive set the permissions of the SystemVersion.plist and the CoreServices folder as being owned by mobile and it still wont work

    Any ideas on how to truly run my app with root privileges?
  2. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    First can we see the code you're using for editing and saving the plist?
  3. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    I'll post in the morning, but like I said, works fine in the simulator just not on the device leading me to think that it's a permissions issue?
  4. Freerunnering

    Freerunnering Member

    Joined:
    Sep 1, 2009
    Messages:
    296
    Likes Received:
    0
    Device:
    4G iPod touch
    Are you running the app from /Applications or where the iPhoneSDK installs it, /var/mobile/applications/ ?
  5. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    /var/mobile/applications/

    Moved it to /Applications and created this file and named it as the same as my app name. Then renamed my apps name to AppName_ and set permissions to 4755 and set the AppName to have the text below in it and set the file to 0755 and it runs as root now

    Please Register or Log in to view images



    Code bellow goes in the new AppName file, taken from Cydia source code so probably dont need that mobileSubstrate line im thinking?

    Code:
    #!/bin/bash
    C=/${0}
    C=${C%/*}
    declare -a flags
    [[ :${DYLD_INSERT_LIBRARIES}: == */MobileSubstrate.dylib: ]] && flags[${#flags[@]}]=--substrate
    exec "${C:-.}"/Firmware_"${flags[@]}" -- "$@" 2>>/tmp/firmware.log
  6. Freerunnering

    Freerunnering Member

    Joined:
    Sep 1, 2009
    Messages:
    296
    Likes Received:
    0
    Device:
    4G iPod touch
    Things only run as root from /Application & with correct permissions.

    Please Register or Log in to view images

  7. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    Thanks man

    Please Register or Log in to view images

    such a simple answer to an annoying question lol ^_^
  8. raziiq

    raziiq New Member

    Joined:
    Aug 23, 2009
    Messages:
    54
    Likes Received:
    0
    Hey there.

    Sorry for buzzing this old thread but i m having the same issues. I have my app in /Applications and has root access but i cant write to a plist file in CoreServices.

    Have you solved this problem??
  9. j0egas

    j0egas New Member

    Joined:
    Apr 3, 2009
    Messages:
    5
    Likes Received:
    0
    Device:
    2G iPod touch
    i can't seem to get this to work wither. When i draged my fake codesigned app to the /Applicatiosn directory, all of the permissions were already 755. I saw the code you posted, and by "app name file", I'm geussing you mean the app binarry located inside the app.app file. So i opened the binary, and put that line of code in it. It still doesn't run as root. Has anyone found a solution for this? Becuase I have been on google for around an hour now, and there is no wel documented post on running an iphone app as root. Any help?
  10. Freerunnering

    Freerunnering Member

    Joined:
    Sep 1, 2009
    Messages:
    296
    Likes Received:
    0
    Device:
    4G iPod touch
    It should just run.
    Don't edit the binary manually after it's codesigned just put it in /apps and it should work.

Share This Page