Re: Q: 10.4.2 "Do Shell Script" revision & passwords
Re: Q: 10.4.2 "Do Shell Script" revision & passwords
- Subject: Re: Q: 10.4.2 "Do Shell Script" revision & passwords
- From: "Gary (Lists)" <email@hidden>
- Date: Wed, 13 Jul 2005 13:11:18 -0400
"Laine Lee" wrote:
> do shell script "sudo bless -folder9
> \"/Volumes/Hard Disk/System Folder\"" password adminpass with administrator
> privileges
The Tech Note for 'do shell' specifically states that you should not use
'sudo' _and_ 'with administrator privileges'.
<http://developer.apple.com/technotes/tn2002/tn2065.html>
Related excerpt:
=====
Q: How do I get administrator privileges for a command?
A: Use the administrator privileges, user name and password parameters like
this:
do shell script "command" user name "me" password "mypassword" with
administrator privileges
user name and password are optional; if you omit the user name, do shell
script assumes it to be the current user; if you omit the password, it will
ask for a password when it runs.
Bear in mind that administrator privileges allow you to change any file
anywhere in the system. You can render your system unbootable or even erase
the entire disk with a few well-placed commands, so exercise caution. Better
yet, don't use administrator privileges unless you absolutely have to.
Unless you are doing system-level development, you should never need to
change anything in /System changing /Library should suffice.
Note: As of Mac OS X 10.4 (Tiger), with administrator privileges executes
the command as setuid-root, not actually as root. This may make a difference
to some scripts; for example, Perl will turn on its "taint mode" security
checks.
WARNING: In Mac OS X 10.4 (Tiger), using sudo(8) with with administrator
privileges will hang. The call to sudo is redundant and creates security
holes; you should simply remove it.
WARNING: Prior to Mac OS X 10.4, with administrator privileges did not work
correctly with multiple commands. You had to turn your multiple commands
into a single invocation of sh, like this:
set normal_command to "command1; command2"
do shell script "sh -c " & quoted form of normal_command with administrator
privileges
=====
--
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden