Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: postflight script on Leopard



On 2/4/08 4:52 AM, "Robert Stainsby" <email@hidden> wrote:

> Hi Jim
>>> Is there an easy way to "drop" admin rights for a postflight script?
>> Using su with the -c flag for the /usr/bin/mdimport command could
>> work.
> 
> There doesn't seem to be a -c flag for either su or mdimport. Were you
> thinking of a different flag?

Huh, you are right.  I have only used -c on Linux, but I checked my man page
before sending the email.  Upon further inspection, it turns out I have a
stale man page, because on Tiger, that option is mentioned in the man page,
on leopord it isn't.  My coworkers who did an archive and install vs my
simple upgrade have the newer man page.

Another possibility might be to use the sudo command instead.  I actually
tested it this time, since I clearly can't trust my man pages.  :)

jkelly-mp:~ root# sudo -u jkelly /bin/echo $PATH > /private/tmp/test
jkelly-mp:~ root# cat /private/tmp/test
/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

So it works.  As I said before, the key will be programmatically determining
who the user really is that is executing the script.  As I said before, perl
is pretty good for this:

jkelly-mp:~ root# perl -e 'print getlogin()."\n";'
jkelly

Jim

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/installer-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: postflight script on Leopard (From: Robert Stainsby <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.