<p>I am thinking about the design of an iPhone app I'd like to create.  One possible problem is that this application will have to run as root (to access certain network ports).  In a typical UNIX app, I'd just get the app to run with setuid, but I'm wondering if that is possible with an iPhone app.</p>

<p>I've read this question in Apple's forum, which is discouraging:</p>

<p><a href="http://discussions.apple.com/thread.jspa?threadID=1664575" rel="nofollow noreferrer">http://discussions.apple.com/thread.jspa?threadID=1664575</a></p>

<p>I understand that Apple wants to limit what a program can do, but there are plenty of good, legitimate reasons for a user to run a program with elevated privileges.  I'm not trying to create a hacker tool here.</p>

<p>I'm sure I could get around this on a jail-broken iPhone, but that's not what I'm after.  Is there any way to run an app with elevated privileges on an unbroken iPhone?</p>

<p>(BTW, there is no need to warn me about the NDA.)</p>

[{'answer_id': 61365, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 4, 'selected': True, 'text': '<p>Section 3.3.4 of the iPhone SDK Agreement suggests that you mustn\'t work outside your sandbox.</p>\n\n<p>Given that <a href="http://speirs.org/2008/09/12/app-store-im-out/" rel="nofollow noreferrer">Apple has been somewhat arbitrary on which applications they permit</a>, you should definitely double-check with them <em>before</em> you start developing.</p>\n\n<p>Compared to 2.0.x, <a href="http://daringfireball.net/linked/2008/09/12/iphone-21-security" rel="nofollow noreferrer">the sandbox restrictions have actually increased in 2.1</a>; you can no longer even read from another application\'s sandbox. So, even if it currently <em>is</em> possible to elevate your app\'s privileges, it very likely won\'t be in a future release.</p>\n'}, {'answer_id': 61369, 'author': 'asksol', 'author_id': 5577, 'author_profile': 'https://Stackoverflow.com/users/5577', 'pm_score': 2, 'selected': False, 'text': "<p>The only options you have is</p>\n\n<ol>\n<li><p>Run the application as root on the iphone</p></li>\n<li><p>Set the applications setuid bit and owner root.</p></li>\n</ol>\n\n<p>I can't see any of them being blessed by Apple.</p>\n\n<p>I guess it depends on what you want to do with the privileges, if you're lucky there might be more fine grained privileges available, but afaik you have to choose a port above 1024.</p>\n"}, {'answer_id': 61585, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 0, 'selected': False, 'text': '<p>Doesn\'t matter one bit if you can do this on your normal desktop computer. The iPhone is not a normal desktop computer.</p>\n\n<p>Unlike a desktop computer, the <em>only</em> way to get an application on the iPhone without a jailbreak is to get it from the App Store.  The <em>only</em> way to get on the App Store is to follow Apple\'s rules, and Apple\'s rules <em>clearly</em> include "no privilege escalation", "no escaping the sandbox", and "no accessing network ports outside the existing, provided APIs".</p>\n\n<p>What you want to do is <strong>not possible</strong>.</p>\n'}]
['https://Stackoverflow.com/questions/61346', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1175/']