Posts

Showing posts from 2018

Save kerberos password in keychain for use with kinit on MacOS (was OS X) for use with network drives

Image
I work for a company that uses and Active Directory domain for the internal network. Therefore, kerberos authentication is supported. MacOS also supports kerberos authentication, so I can replicate most of the single sign-on experience on my Mac. I wrote a simple shell script to get a kerberos ticket-granting ticket and mount the network drives: #! /bin/bash # get the local IP address theIP = ` /sbin/ifconfig | /usr/bin/grep "inet 10" | /usr/bin/grep -v inet6 | /usr/bin/cut -d " " -f2 | /usr/bin/cut -d . -f1` # if IP address starts with 10 then I am probably on work's internal network if [ $theIP -eq 10 ] ; then /usr/bin/kinit -f --enterprise --canonicalize username@company . com@COMPANY . COM /usr/bin/open 'smb://server.company.com/share' fi To make this script really useful, I save my password securely in MacOS's keychain so that kinit can grab it automatically. I use the following command in the terminal: