# Authenticate the user in AppleScript Studio?



## dricci (Apr 6, 2002)

Hi,

Just wondering if there was a way to authenticate a user in AppleScript Studio? I want to have the user execute a shell script that requires sudo/root access and I am wondering if there's a way to make one of those little lock buttons which will let the user execute the script.

I'm really new at this still and not exactly sure what I'm doing (piecing together stuff from samples) so any info you have, please share.

Thanks!


----------



## simX (Apr 6, 2002)

The command is do shell script "blah" with administrator privileges .  Note that this will only allow you to run as the current user, so if the current user is not an administrator, no administrator will be able to put in his username to run the command as root.  You'll have to temporarily make a workaround to this by asking the user for his username first, and then executing the shell script as that user.

Also of note, it seems there's a slight security flaw.  No matter if the user puts in the right password or not, the command executes as root (At least in AppleScript v.1.8.2b3).  For this reason, you might want to hold off doing the script like this.

For me, I'm kind of stuck with my app at this point because I'm waiting for the new version of AppleScript Studio and AppleScript to come out, which should be really soon (with the April Developer Tools).


----------



## ksuther (Apr 6, 2002)

Or if you want them to supply a password, do:


> do shell script "/i/am/a/bunny' -setOF" password "bunny" with administrator privileges



That should work


----------

