title: Using TGT acquired in Java for SSH/Other applications
body: <p>Currently, I am able to authenticate users in a java application by using JAAS and grabbing the ticket-granting-ticket that is sent from a Windows server running Active Directory.  This is easily done with the <code>Krb5LoginModule</code> in java.  </p>
  
  <p>Now I would like to run an ssh command from my java application and use my TGT to enable ssh not to ask for password.  I have seen some tutorials (<a href="http://www.visolve.com/security/ssh_kerberos.php" rel="nofollow">OpenSSH &amp; Kerberos</a>) for getting ssh to work with kerberos, but they use <code>kinit</code> to get their TGT and the ticket is stored in /tmp/krbcc_XXX.  Then after the ticket is generated they can ssh freely. </p>
  
  <p>I could write the TGT to disk and store it in /tmp/krbcc_XXX or I could run the ssh command in a <code>PrivilegedAction</code>, however I don't know if either will work.  Is there an accepted way to do this?</p>
  
  <p>Basically, I would like to call something like this and have it not ask me for a password:</p>
  
  <pre><code>// Create Command.
  List&lt;String&gt; arguments = new ArrayList&lt;String&gt;();
  arguments.addAll(Arrays.asList("ssh", "user@host", "xterm"));
  
  // Run SSH command.
  ProcessBuilder process = new ProcessBuilder(arguments).start();
  </code></pre>