summaryrefslogtreecommitdiffstats
path: root/bashrc/common/ssh-agent-forwarding.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bashrc/common/ssh-agent-forwarding.sh')
-rw-r--r--bashrc/common/ssh-agent-forwarding.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/bashrc/common/ssh-agent-forwarding.sh b/bashrc/common/ssh-agent-forwarding.sh
index fb17146..2d40652 100644
--- a/bashrc/common/ssh-agent-forwarding.sh
+++ b/bashrc/common/ssh-agent-forwarding.sh
@@ -29,18 +29,18 @@ fixssh() {
wipe_removed_sockets
# if this login is via ssh and ssh-agent is forwarded
-if [ -n "$SSH_AUTH_SOCK" -a -n "$SSH_CLIENT" ]; then
+if [ -n "$SSH_AUTH_SOCK" -a -n "$SSH_CLIENT" -a "$SSH_AUTH_SOCK" != "${HOME}/.ssh-agent-forwarded-sock" ]; then
# add current socket
echo "$(date +%s) $SSH_AUTH_SOCK $SSH_CLIENT" >> "${HOME}/.ssh-agent-forwarding"
# remove old symlink
- if [[ -L "${HOME}/.ssh-agent-forwarded-sock" ]]; then
+ if [ -L "${HOME}/.ssh-agent-forwarded-sock" ]; then
rm -f "${HOME}/.ssh-agent-forwarded-sock"
fi
# create static symlink to socket
- if [[ ! -e "${HOME}/.ssh-agent-forwarded-sock" ]]; then
+ if [ ! -e "${HOME}/.ssh-agent-forwarded-sock" ]; then
ln -sf "$SSH_AUTH_SOCK" "${HOME}/.ssh-agent-forwarded-sock"
else
echo "Warning: ${HOME}/.ssh-agent-forwarded-sock exists and is not a symlink!"