Update sshrc

This commit is contained in:
David Tomaschik
2026-01-13 09:25:15 -08:00
parent 0e491395da
commit 243da55c86

View File

@@ -5,23 +5,26 @@
REMOTE_LINK="${HOME}/.ssh/ssh_auth_sock" REMOTE_LINK="${HOME}/.ssh/ssh_auth_sock"
if [ "${1:-}" = "force" ] && [ -S "${SSH_AUTH_SOCK}" ] ; then if [ -S "${SSH_AUTH_SOCK}" ] ; then
ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}" SSH_REMOTE_AUTH_SOCK="${SSH_AUTH_SOCK}"
exit 0 export SSH_REMOTE_AUTH_SOCK
if [ "${1:-}" = "force" ] || [ ! -S "${REMOTE_LINK}" ] ; then
ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}"
SSH_AUTH_SOCK="${REMOTE_LINK}"
export SSH_AUTH_SOCK
fi
fi fi
if test \! -S "${REMOTE_LINK}" -a -S "${SSH_AUTH_SOCK}" ; then # if stdin is a tty, don't do the cookie step
ln -sf "${SSH_AUTH_SOCK}" "${REMOTE_LINK}" if [ ! -t 0 ] ; then
fi # Handle X forwarding, per sshd(8)
if read -r proto cookie && [ -n "$DISPLAY" ]; then
# Handle X forwarding, per sshd(8) if [ "$(echo "$DISPLAY" | cut -c1-10)" = 'localhost:' ]; then
if read proto cookie && [ -n "$DISPLAY" ]; then # X11UseLocalhost=yes
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then echo add "unix:$(echo "$DISPLAY" | cut -c11-)" "$proto" "$cookie"
# X11UseLocalhost=yes else
echo add unix:`echo $DISPLAY | # X11UseLocalhost=no
cut -c11-` $proto $cookie echo add "$DISPLAY $proto $cookie"
else fi | xauth -q -
# X11UseLocalhost=no fi
echo add $DISPLAY $proto $cookie
fi | xauth -q -
fi fi