Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'sudo and you' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
sudo and you
Authored by: Mikey-San on Jan 20, '03 05:10:25PM

If you're going to let this script run in the background, take note:

1. "with administrator privileges" invokes sudo, which is (by default) left open for 5 minutes when used
2. Just because you'll be presented with an AppleScript dialog doesn't mean it automatically closes sudo access--AppleScript will /always/ ask for it, as it doesn't pay attention to the sudo time stamp.

You may want to add:

do shell script "sudo -K"

... To that script before the end tell.



[ Reply to This | # ]
then again ...
Authored by: Mikey-San on Jan 20, '03 05:12:37PM

You should never put your admin password in an AppleScript, anyway. ;-)

Heh.


-/-



[ Reply to This | # ]
Revisited
Authored by: mahakali on Jan 21, '03 04:44:32PM
Interesting. (about sudo -K) I'm new to unix, by the way. And learn new things each day :) I revised the script to display a dialog to enter the admin password instead. And added a dialog at the end. Still the dialog doesn't contain complete log. So, here it is:
display dialog "enter your admin password:" default answer ""
set admin_password to (text returned of result)
do shell script "sudo -K diskutil repairPermissions /" ¬
password admin_password with administrator privileges
set rp_log to (do shell script "sudo -K diskutil repairPermissions /")
display dialog rp_log
Is this how we use the sudo -K, by the way, Mike?

[ Reply to This | # ]
Revisited
Authored by: Mikey-San on Jan 22, '03 09:16:24AM

Enter:

sudo -K

As a separate command to reset the sudo time stamp. E.g.,

do shell script "rm -rf ~/Applications/Internet\ Explorer.app" with administrator privileges
do shell script "sudo -K"


-/-
Mikey-San



[ Reply to This | # ]