From: Mike Frysinger Date: Sun, 15 Jun 2014 01:14:09 +0000 (-0400) Subject: do not run keychain when ssh auth forwarding is enabled X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d64d0217daa0347501296f2f496fbc7c77be32dc;p=home.git do not run keychain when ssh auth forwarding is enabled --- diff --git a/.profile.d/keychain.sh b/.profile.d/keychain.sh index 8934549..14a6289 100644 --- a/.profile.d/keychain.sh +++ b/.profile.d/keychain.sh @@ -1,5 +1,9 @@ -if type keychain >/dev/null 2>&1 ; then - : ${HOSTNAME:=$(hostname)} - [ -e ~/.keychain/${HOSTNAME}-sh ] && . ~/.keychain/${HOSTNAME}-sh - [ -e ~/.keychain/${HOSTNAME}-sh-gpg ] && . ~/.keychain/${HOSTNAME}-sh-gpg +# If an auth sock is already set & available, use it. +# This way ssh agent forwarding still works. +if [ ! -S "${SSH_AUTH_SOCK}" ] ; then + if type keychain >/dev/null 2>&1 ; then + : ${HOSTNAME:=$(hostname)} + [ -e ~/.keychain/${HOSTNAME}-sh ] && . ~/.keychain/${HOSTNAME}-sh + [ -e ~/.keychain/${HOSTNAME}-sh-gpg ] && . ~/.keychain/${HOSTNAME}-sh-gpg + fi fi