[launchd-dev] Accessing keychain in a launchd process

Brad Reynolds bradleyjames at gmail.com
Sun Aug 17 09:46:36 PDT 2008


The problem was that I wasn't specifying the correct sessionType when
loading the agent via launchctl (i.e. launchctl load -S Aqua
myagent.plist).  Once I did that I had the appropriate context to
access the keychain in.  Thanks for the help!

-bradr

On Mon, Aug 11, 2008 at 8:26 PM, Brad Reynolds <bradleyjames at gmail.com> wrote:
> Thanks for the reply Quinn.  I haven't seen that tech note.  I've got
> some reading to do.
>
> But to clarify, I don't necessarily want it to run in a GUI context.
> I'm just wanting to authorize this script, when run via launchd, to
> access the keychain.  A symptom of the my current problem is that it
> can't display the GUI.  This occurs because the script doesn't have
> access to the keychain.  I'd like to give it access beforehand so that
> it is authorized and the GUI is avoided altogether.  When I run the
> script from the command line it doesn't prompt for the password since
> I've given it access.  But when run from launchd it tries to prompt,
> thus the problem.
>
> I'll give the document a read and if I can't figure it out I'll reply
> again.  Thanks.
>
> -bradr
>
> On Mon, Aug 11, 2008 at 3:28 AM, Quinn <eskimo1 at apple.com> wrote:
>> At 20:55 -0700 10/8/08, Brad Reynolds wrote:
>>>Any ideas on what the program might be when run from launchctl?
>>
>> What context is your "launchd process" running in?  Is it a daemon or
>> an agent?  If it's an agent, what type of agent (see Table 1 in
>> TN2083 for the list of options)?
>>
>> <http://developer.apple.com/technotes/tn2005/tn2083.html>
>>
>> I would only expect this to work from a GUI launchd agent.  Daemons
>> and other agents run outside of the GUI login context, and thus can't
>> safely display UI.
>>
>> S+E
>> --
>> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
>> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>> _______________________________________________
>> launchd-dev mailing list
>> launchd-dev at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev
>>
>


More information about the launchd-dev mailing list