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?