Created
April 26, 2014 04:36
-
-
Save netj/11311822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# mosh-server wrapper for Kerberos/AFS home environment | |
# | |
# Author: Jaeho Shin <[email protected]> | |
# Created: 2014-04-25 | |
# Requires: readlink in GNU coreutils | |
set -eu | |
self=$(readlink -f "$0") | |
next=$(type -ap mosh-server | xargs -L1 readlink -f | | |
grep -vxF "$self" | head -1) | |
# if Kerberos tickets are available | |
if klist &>/dev/null; then | |
# put mosh-server in a Process Authentication Group getting an AFS Token | |
pagsh -c 'aklog; exec "$@"' -- "$next" "$@" | |
else | |
# otherwise, simply call next | |
exec "$next" "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment