From: martin f. krafft Date: Fri, 15 May 2020 11:42:23 +0000 (+1200) Subject: sshrc needs to handle xauth X-Git-Url: https://git.madduck.net/etc/ssh.git/commitdiff_plain/56b5273149826dcedb62998357ec756abf74712f sshrc needs to handle xauth --- diff --git a/.ssh/rc b/.ssh/rc index a70d65c..a755dca 100644 --- a/.ssh/rc +++ b/.ssh/rc @@ -3,3 +3,14 @@ PERSISTENT_AUTH_SOCK=$VARDIR/ssh/persistent-ssh-auth.sock if [ ! -S "$PERSISTENT_AUTH_SOCK" ] && [ -S "$SSH_AUTH_SOCK" ]; then ln -sf "$SSH_AUTH_SOCK" "$PERSISTENT_AUTH_SOCK" fi + +if [ -n "${DISPLAY:-}" ]; then + read proto cookie + if [ "${DISPLAY%%:*}" = localhost ]; then + # X11UseLocalhost=yes + echo add unix:$(echo $DISPLAY | cut -c11-) $proto $cookie + else + # X11UseLocalhost=no + echo add $DISPLAY $proto $cookie + fi | xauth -q - +fi