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.