[launchd-dev] Environment variables

Hamish Allan hamish at gmail.com
Thu Nov 15 05:00:38 PST 2007


Hi,

The man page for launchd.plist says:

SecureSocketWithKey <string>
This optional key is a variant of SockPathName. Instead of binding to
a known path, a securely generated socket is created and the path is
assigned to the environment variable that is inherited by all jobs
spawned by launchd.

However, the SSH_AUTH_SOCK environment variable generated by Leopard's
/System/Library/LaunchAgents/org.openbsd.ssh-agent.plist doesn't seem
to be available to my ~/Library/LaunchAgents. E.g. the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>test.7B21D717-E7AE-4DB0-905F-7D40F8A6ABE2</string>
  <key>Program</key>
  <string>/usr/bin/env</string>
  <key>inetdCompatibility</key>
  <dict>
    <key>Wait</key>
    <false/>
  </dict>
  <key>Sockets</key>
  <dict>
    <key>Listeners</key>
    <dict>
      <key>SockNodeName</key>
      <string>127.0.0.1</string>
      <key>SockFamily</key>
      <string>IPv4</string>
      <key>SockServiceName</key>
      <string>34567</string>
    </dict>
  </dict>
</dict>
</plist>

when accessed via 'nc localhost 34567' generates a list of several
environment variables, none of which is SSH_AUTH_SOCK.

Is this the expected behaviour? If so, how can I make a LaunchAgent
for ssh that can access my ssh-agent across reboots?

Thanks,
Hamish


More information about the launchd-dev mailing list