I would like to mount my afs account at the university on my home laptop automatically. The problem is that my uni won't allow afs access if I use ssh public/private keypair authentication. That means there is no way around entering the password for my account when I want to mount the remote afs filesystem. (That seems to exclude doing it with autofs+sshfs.)
As a workaround, I've created a script using expect, that enters my password for me. It looks something like:
spawn kinit -A -f login@HOST
expect "login@HOST's Password:"
(yes, I'm aware storing my password in a script like this isn't very safe
If I run this script myself from shell, it works as it should: I get a kerberos token and I can ssh to my uni account, or use sshfs to mount my afs account locally, without having to enter my password again.
My question now is, how can I make this script run automatically once I've established an internet connection? I use wifi at home, so generally it takes until about a minute after booting until my connection is established. This would exclude running the above script at startup?
I read somewhere that I could put the script at /etc/dhcp3/dhclient-exit-hooks.d/ to have it run automatically once an ip address has been assigned, but that doesn't seem to work (I boot, connect to the internet, but no token). Is there a log somewhere I could check to see if the script runs/generates errors?
I'm really new to all this, so I don't really have a clue of how these things fit together. All information/hints/workarounds you can give me will be highly appreciated!