问题标签 [authopen]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
macos - How do you write a Dictionary to a plist with system privs?
I am writing a program that needs to write a plist file that's owned by root.
The way to create the file is apparently using authopen
with the -w
option. The problem is that authopen
takes its input from stdin (or sends its permissions back using the SCM_RIGHTS
extension to the calling process). There's also an option that uses something called the "Authorization External Form" structure which I don't quite understand.
In any event, what I would like to do is write my plist to a temporary file and then to use authopen
or a similar authorization mechanism to do a privileged rename of the file in question.
So I need a way to either:
- Write the NSDictionary to a pipe, rather than to a file.
- Write the NSDictionary to a file, then provide that file to the authopen process as stdin.
- Use
authopen
to do a rename
or something else.
Is there any code for doing this?
Thanks.
linux - Linux 上的 authopen 等价物是什么?
我想暂时提升程序的权限,以便我可以写入设备文件(通常是像 on/dev/sdc
等的 SDCard)。在 OSX 上,我可以运行authopen
请求用户许可(如有必要)并取回打开的文件句柄。目前,该程序是通过sudo
在 Linux 上调用的,但有人问我是否有可能消除对授予权限的需求sudo
或至少减少授予的权限数量。这可能吗?例如,authopen
在 Linux 上是否有等效的策略,或者程序使用的策略是否不同?