Skip to content

Instantly share code, notes, and snippets.

@pmbuko
pmbuko / renewLionKerb.scpt
Created March 21, 2012 16:19
An AppleScript to interactively obtain/renew a kerberos ticket in Lion.
try
-- test for Kerberos ticket presence and attempt to renew
do shell script "/usr/bin/klist | /usr/bin/grep krbtgt"
do shell script "/usr/bin/kinit -R"
on error
-- offer to renew Kerberos ticket
set response to (display dialog "No Kerberos ticket was found. Do you want to renew it?" with icon 2 buttons {"No", "Yes"} default button "Yes")
if button returned of response is "Yes" then
try
set thePassword to text returned of (display dialog "Enter your password:" default answer "" with hidden answer)