How can I use Automator to generate a kerberos ticket using KINIT?
You can easily package shell commands inside an Automator application (or service) using the “Run Shell Script” action. However, this will run the commands in a non-interactive shell  (for an explanation of the difference between interactive and non-interactive shells, see the pertinent section of the Advanced Bash Scripting Guide – simply put, you will not have access to the terminal for the password prompt, and if kinit is not aware of this, your script will hang). There are two ways around that:


script Terminal.app to execute your command instead of executing it directly. In that case, you will need a “Run AppleScript” action instead, containing the following command:

tell application "Terminal" to do script "kinit &lt;options&gt;"


which will open a new Terminal tab running the given command.
use kinit’s --password-file option and pass it the password inside your workflow, i.e.

echo &lt;password&gt; | kinit --passwordfile=STDIN &lt;options&gt;


To avoid storing your password in plain text inside the workflow, you can securely store it in the OS X Keychain and retrieve it from there. Although possible via a shell script (the TextMate blog has details on how to achieve that – be sure to read the comments), there are so many gotchas to that I’d recommend  using a bit of AppleScript and Daniel Jalkut’s excellent Usable Keychain Scripting app. Once installed, the following bit of AppleScript will retrieve your password (assuming the account name is “kinit”):

tell application "Usable Keychain Scripting" to get password of first generic item of current keychain whose account is "kinit"


Either wrap it in an osascript shell command, i.e.

passphrase=$(osascript -e '&lt;command above&gt;')


or, as you are using Automator, add an AppleScript action, retrieve the passphrase inside it and pass it to the shell script.