Re: writing files as root from Installer Plugin
Re: writing files as root from Installer Plugin
- Subject: Re: writing files as root from Installer Plugin
- From: Stéphane Sudre <email@hidden>
- Date: Fri, 9 May 2008 21:41:15 +0200
On May 9, 2008, at 1:05 PM, Toby Blake wrote:
Hi again,
I hope this is the appropriate list to send this to - it's perhaps
more of a general cocoa programming question, so feel free to direct
me elsewhere.
One thing my installer plugin needs to do is take input from the user,
validate it and write it out to a file. There's every possibility
that this file could be only writable by root on any given system, so
my plugin needs to get appropriate authorization for the user to write
this file as root.
I've read the doc "Performing Privileged Operations With Authorization
Services", but this seems to be C only. It appears that the
Objective-C way would be to use SFAuthorizationm but docs on this seem
a little thin on the ground. What I'd really like to see is some
sample code. Does anyone have such a thing? Or is there perhaps a
better way to achieve what I want to do? Or should I just use a chunk
of C in my plugin?
Many thanks in advance and apologies for the vagueness of my
questions.
Assuming your package requires root authentication (or admin
depending on the terminology) _and_ the position of this file can not
change, then a solution is to just write the file and then use a
postflight script to fix the permissions (and eventually move it to
another location that would have required to be root to do it).
If you require root authentication, the postflight script will be run
as root. This should avoid asking the user to enter twice his/her
password.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden