with administrator privileges on Panther

I’ve built an uninstaller script to remove components in an application and it requires admin privileges to remove all of the
files. There are about 10 lines that each call a do shell script “rm” command.

do shell script "rm -rf /dir1" with administrator privileges
do shell script "rm -rf /dir2" with administrator privileges
do shell script "rm -rf /dir3" with administrator privileges
do shell script "rm -rf /dir4" with administrator privileges

In Tiger, using with administrator privileges seems to cache the password after the first call and eliminates subsequent files without
asking for the password again. In Panther, however, the user is prompted each time for the password, which I believe is confusing.
It’s as if the password is not being accepted.

Does anyone have any suggestions for a solution so that Panther users can get a similar experience as those on Tiger?

Thanks for the suggestions.

  • j

I do not have a copy of panther to test on, but assuming that it is working you just don’t want to have to type it each time then build all your commands into one statement.

do shell script "rm -rf /dir1;rm -rf /dir2;rm -rf /dir3;rm -rf /dir4" with administrator privileges

Such an obvious solution. Works perfectly.


  • j

I was thinking that too James, but look at the Tech Note:

Hi Bruce,

Unless I’m not thinking clearly (and that could be the case I had a mail server fail today) there isnt an issue there. Creating a “normal_command” is essentially what I had done. I believe the TN is saying to do as I suggested and that the original format as posted by the OP is what needs to be worked around.

This method works well, except for the fact that it doesn’t work when I’m trying to delete .kext files from the “/Library/Extensions” directory. I have all the files as a single “do shell script” statement as described above, but it deletes all the other files except the .kext files. However, if I separate the kext files and have repeated " password with administrator privileges statements, it will work. How can I get it all to delete with one administrator password session as I have done in Tiger and Leopard?

Thanks and God bless.


Your original response was running multiple commands (rm four times), where as I was only running one (sh).