tags:

views:

42

answers:

1

I want to elevate my app's privilege to super-user. Installer app supports this by displaying this dialog. How can I show this dialog to elevate privilege?

PS. I'm making a kind of packet sniffer application on Mac OS X. I'm using pcap lib. (which is part of tcpdump)

+2  A: 

AuthorizationExecuteWithPrivileges with kAuthorizationRightExecute

See BetterAuthorizationSample

As a general rule, you should not run GUI applications as root. You should make a command line tool that you can run as root, and control it from your user space GUI application.

drawnonward
Why should I avoid executing GUI part as root?
Eonil
@Eonil: Because [privilege separation](http://en.wikipedia.org/wiki/Privilege_separation) is a good idea.
Chris Johnsen
@Chris: Thanks!
Eonil