Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a Kerberos single-sign-on system in our company. This means that I can just type kinit user@DOMAIN in the terminal, and then I can access all IT resources like file servers, internal wiki, svn server etc.

The problem is, I stay logged in for only 10 hours, so I need to run kinit every morning when I wake my computer from sleep, and every time I restart the computer.

Is there a way to run this command automatically when I start the computer, and every ten hours after that?

I did some research and I assume the correct way to do this is to use a launch agent, because the command must be run as the current user (kinit needs the password from the keychain).

I tried using the following launch agent file, but it doesn't work as expected:

<?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>net.jabakobob.auto-kinit</string>
    <key>OnDemand</key>
    <true/>
    <key>RunAtLoad</key>
    <false/>
    <key>UserName</key>
    <string>user</string>
    <key>Program</key>
    <string>/usr/bin/kinit</string>
    <key>ProgramArguments</key>
    <array>
        <string>user@DOMAIN</string>
    </array>
    <key>StartInterval</key>
    <integer>10800</integer>
</dict>
</plist>

I don't know why this launch agent doesn't work, and I have no clue how to debug it. Any ideas?

share|improve this question

1 Answer 1

/Library/LaunchAgents/ are tied to individual users where as /Library/LaunchDaemons/ are tied to the machine as a whole. After the system is booted and the kernel is running, property list files found in /Library/LaunchDaemons/ are loaded first as these are system-level daemon.

Try to put your plist in /Library/LaunchDaemons/ and see if it works. Because goal is to run kinit at boot up, so should not matter if it is loaded at system-level.

If its not working please reply here with your findings.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.