From d64d0217daa0347501296f2f496fbc7c77be32dc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 14 Jun 2014 21:14:09 -0400 Subject: [PATCH] do not run keychain when ssh auth forwarding is enabled --- .profile.d/keychain.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 -- 2.39.5