Run app as root?

Discussion in 'iOS Development' started by wyndwarrior, Feb 20, 2010.

  1. wyndwarrior

    wyndwarrior Active Member

    Joined:
    Jun 8, 2009
    Messages:
    1,433
    Likes Received:
    1
    Device:
    3G iPod touch
    Is there any way to make your application run as root? Such as being able to run a "dpkg" command.
  2. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    Cydia does this by having 2 executables.. _Cydia and Cydia, I believe _Cydia gets started when the app is loaded, it then runs Cydia as root.

    I think it's already documented somewhere here how to do it.
  3. wyndwarrior

    wyndwarrior Active Member

    Joined:
    Jun 8, 2009
    Messages:
    1,433
    Likes Received:
    1
    Device:
    3G iPod touch
    So something like this?

    Code:
    #!/bin/bash
    dir=$(dirname "$0")
    exec "${dir}"/MyProgram_ "$@"
  4. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    The other way around.
    ------------------double post merged------------------
    That should do the job.
    However, sometimes it may be more secure to chown root + chmod 4755 + execute another program/script whose only task is doing something "rootish" to protect the user from potential attacks to your "main" app.
  5. wyndwarrior

    wyndwarrior Active Member

    Joined:
    Jun 8, 2009
    Messages:
    1,433
    Likes Received:
    1
    Device:
    3G iPod touch
    Ok, I did a simple
    Code:
    echo "`whoami`"
    in my app and it showed up as mobile. Any ideas?
  6. raziiq

    raziiq New Member

    Joined:
    Aug 23, 2009
    Messages:
    54
    Likes Received:
    0
    while installing the apps through Cydia, you can make your app to be run as root, google for postinst scripts and you ll get lots of info on how to do that.

Share This Page