summaryrefslogtreecommitdiff
path: root/misc/dotfiles/ssh/rc
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2024-02-24 18:36:32 +0000
committerDmitry Ilvokhin <d@ilvokhin.com>2024-02-24 18:36:32 +0000
commit2b29e812468ae2f33a4d37e2e280b7080f11ee86 (patch)
tree15826a929d63c05081399d970e8caaf6d0ecdc23 /misc/dotfiles/ssh/rc
parent505d0e3202677729f9c5a9c03cb5ddfd9faf6d78 (diff)
downloadinfra-2b29e812468ae2f33a4d37e2e280b7080f11ee86.tar.gz
infra-2b29e812468ae2f33a4d37e2e280b7080f11ee86.tar.bz2
infra-2b29e812468ae2f33a4d37e2e280b7080f11ee86.zip
Add simple dotfiles management playbook
Diffstat (limited to 'misc/dotfiles/ssh/rc')
-rwxr-xr-xmisc/dotfiles/ssh/rc20
1 files changed, 20 insertions, 0 deletions
diff --git a/misc/dotfiles/ssh/rc b/misc/dotfiles/ssh/rc
new file mode 100755
index 0000000..c129eb8
--- /dev/null
+++ b/misc/dotfiles/ssh/rc
@@ -0,0 +1,20 @@
+#! /usr/bin/env bash
+
+# Credits: https://gist.github.com/martijnvermaat/8070533
+
+# Fix SSH auth socket location so agent forwarding works with screen.
+if test "$SSH_AUTH_SOCK" ; then
+ ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
+fi
+
+# Taken from the sshd(8) manpage.
+if read proto cookie && [ -n "$DISPLAY" ]; then
+ if [ `echo $DISPLAY | cut -c1-10` = '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