Makefile: add pickrand
[cmccabe-bin] / ssh-restore.sh
1 #!/usr/bin/env bash
2
3 #
4 # Update the value of the ~/.ssh/ssh_auth_sock symlink to point to the new
5 # active socket.
6 #
7 # I like to use ssh-agent forwarding plus tmux.  In practice, this means that
8 # the first time I start tmux, it automatically knows how to talk to my
9 # currently active agent.  But then, when I detach tmux and log out of ssh,
10 # that agent goes away.  On my next ssh login, I need to tell tmux about the
11 # new agent by updating this symlink.  This script does that.
12 #
13
14 if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
15     ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
16 fi
17 export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock