本文介绍了我应该使用什么样的API来提升Mac OS X中超级用户的用户权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提升我的应用程序的权限给超级用户。
安装程序通过显示来支持此操作。
如何显示此对话框来提升权限?



PS。
我正在Mac OS X上制作一种数据包嗅探器应用程序。我正在使用pcap lib。 (它是tcpdump的一部分)

解决方案

with kAuthorizationRightExecute



请参阅



作为一般规则,您不应以root身份运行GUI应用程序。您应该创建一个可以以root身份运行的命令行工具,并从用户空间GUI应用程序中进行控制。


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)

解决方案

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.

这篇关于我应该使用什么样的API来提升Mac OS X中超级用户的用户权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 14:47