以编程方式升级应用程序权限 [英] Escalate App Privileges Programmatically OS X

查看:178
本文介绍了以编程方式升级应用程序权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一些挖掘,我看到浮动的主要想法是使用setuid / getuid和使用授权服务(由于某种原因给我一个符号错误,当编译,但现在似乎已弃用)。



我的应用程序需要能够在特定点请求root访问权限(用于访问原始磁盘驱动器),最好使用OS X身份验证对话框对于OS X,我不知道该调用什么)。

解决方案

授权服务AFAIK支持得很好。 p>

这里有个链接到一个教程(有示例项目!),您可以使用它来启动一个小工具,您可以在其中获取管理员权限,然后可以调用 setpriority API (为您连接的文档)。


I've done some digging and the main ideas I've seen floating around are using setuid/getuid and using the Authorization Services (which, for some reason gives me a symbol error when compiling but appears to be deprecated now).

My application needs to be able to request root access (for accessing a raw disk drive) at a certain point, preferably with the OS X authentication dialog (I'm new to OS X so I have no idea what to call that).

解决方案

Authorization Services is pretty well supported, AFAIK.

Here's a link to a tutorial (with sample projects!) which you can use to launch a small tool in which you can get admin priviledges and then you can call the setpriority API on your calling process (documentation linked for you).

这篇关于以编程方式升级应用程序权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆