Re: do shell script...password...with administrator privileges: another leopard bug?
Re: do shell script...password...with administrator privileges: another leopard bug?
- Subject: Re: do shell script...password...with administrator privileges: another leopard bug?
- From: deivy petrescu <email@hidden>
- Date: Sun, 6 Jul 2008 13:37:57 -0400
On Jul 6, 2008, at 11:16, Axel Luttgens wrote:
Le 6 juil. 08 à 16:13, Loren Ryter a écrit :
[...]
Is there another way to successfully test this?
[...]
Hello Loren,
It looks like that starting with Leopard, do shell script expects an
explicit user name instead of assuming the current user.
So, this one seems to emulate the behavior as observed under Tiger:
set user_pass to "ii"
try
set user_name to do shell script "id -un"
set test_password to do shell script ("ls /private/var/root/")
user name user_name password user_pass with administrator privileges
on error myerr
log myerr
end try
and should be working equally well under both Tiger and Leopard.
HTH,
Axel
Hi Axel,
I have not tried, but the user name might be needed if the user logged
does not have admin privileges.
It the user does, it is not necessary to add the user name.
Loren, as for error redirection check this:
create a file named "errorlog in the root directory, then run the
following script:
<script>
set user_pass to "test"
try
set test_password to do shell script ("ls /pr0vate/var/root/ 2>
errorlog") password user_pass with administrator privileges
on error
display dialog (do shell script "more errorlog")
end try
</script>
Note that a simple error in password will not cause any error at all
even in the shell. You will be prompted but it will just stop asking
you for a password after the 3rd pass.
By the way, it was different before, a wrong password would return an
error number 1. I checked some of my old scripts.
I still believe you can not call it a bug, but you can certainly
complain.
So can we!
And I will.
Deivy _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden