diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2009-02-23 13:41:04 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2009-02-23 13:41:04 +0100 |
commit | 03e9376f0d6b0b7f6e6887fd196ffbb30fb42a2b (patch) | |
tree | 5ff63ad2580eb976b30e0e87c847c89cc08bc67f /bashrc | |
parent | e1c8351efdc0f7ee893e3858af9b02c643115806 (diff) | |
download | dotfiles-03e9376f0d6b0b7f6e6887fd196ffbb30fb42a2b.tar.gz dotfiles-03e9376f0d6b0b7f6e6887fd196ffbb30fb42a2b.tar.xz dotfiles-03e9376f0d6b0b7f6e6887fd196ffbb30fb42a2b.zip |
do not create/record ssh_auth_sock if it is set to the symlink
Diffstat (limited to '')
-rw-r--r-- | bashrc/common/ssh-agent-forwarding.sh | 6 |
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!" |