1
0

sshrc 648 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # based on/using http://stackoverflow.com/questions/21378569 and
  3. # https://gist.github.com/martijnvermaat/8070533
  4. # Fix SSH auth socket location so agent forwarding works with tmux
  5. if test "$SSH_AUTH_SOCK" ; then
  6. ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
  7. fi
  8. # Taken from the sshd(8) manpage.
  9. if read proto cookie && [ -n "$DISPLAY" ]; then
  10. if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
  11. # X11UseLocalhost=yes
  12. echo add unix:`echo $DISPLAY |
  13. cut -c11-` $proto $cookie
  14. else
  15. # X11UseLocalhost=no
  16. echo add $DISPLAY $proto $cookie
  17. fi | xauth -q -
  18. fi