Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write an applescript that sends some actions to an application (specifically waterroof). The problem is, the application periodically asks me for the admin password when I open the settings panel I am interested in. It works on a time-delay, so if I already entered the password in the previous x minutes, it does not prompt. Because I can't rely on being asked, I can't consider pausing and entering the password as part of the script.

Is there a way to tell the app/OS that I want to stay logged in to the app with admin privileges, and that it shouldn't ask me? I want to exhaust this possibility before I attempt to check for its existence etc in code.

share|improve this question

As far as I know, the timeout for authorization in OS X (if done properly) is set in the Policy Database located at etc/authorization, usually programmatically. It looks like a plist file, and if an item has no 'timeout' key, then it has no timeout.

I do know that the preference is usually set in code using Apple's APIs (as shown in Apple's Authorization Services Programming Guide and the function reference).

This is a protected file. Use something like sudo pico /private/etc/authorization to edit it.

The entry in this file will have a title using a kind of descriptor '' or something like that (e.g., com.stackexchange.superuser.deleteuser) - which is specific to each application, so look for that. (It's in alphabetical order to make things easier, I believe).

enter image description here

If there is no such entry, then the app probably grabs authorization in another way which I don't know about. I just tried adding a timeout to an app I wrote - it worked. I then deleted it again - and the timeout disappeared. It should work in your case, I'm guessing.

You do mention a settings panel - if that involves System Preferences then I don't know how it works either. There's no way to do it through applescript.

Edit: If there is no such entry

ANOTHER way an application may authorize is using the now deprecated and insecure method AuthorizationExecuteWithPrivileges. I'm guessing that if an application doesn't have its own entry in the Policy Database, it uses AuthorizationExecuteWithPrivileges. It may be that the application you're trying to work with uses this.

There is an entry in the Policy Database for this particular method called system.privilege.admin, but note that modifying this and deleting the timeout will probably change the timeout for all applications using AuthorizationExecuteWithPrivileges, not just the one you're trying to change. It may be worth a try.

enter image description here

share|improve this answer
Thanks for such a detailed response and diagramming skills. Unfortunately there's no entry in there for the application. – Ben Packard Aug 23 '11 at 1:47
What application might it be? – Vervious Aug 23 '11 at 2:03
I also added some information, see if it helps! – Vervious Aug 23 '11 at 2:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .