Last active
October 12, 2021 21:58
-
-
Save tsaavik/c0512d2d2d138a45d0db45fc4c410277 to your computer and use it in GitHub Desktop.
Are your long running ssh agent sockets failing? Perhaps something is cleaning /tmp? This rc file for ssh fixes all these problems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fix ssh sockets so they always work in Tmux/Screen, even after you re-connect dmcanulty 2021 | |
# | |
# After putting this file at ~/.ssh/rc add the following to your ~/.bash_aliases | |
# alias ssh="SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock; ssh" | |
# alias git="SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock; git" | |
# If the symlink does not point at a valid socket, and the env variable is a valid socket, make a symlink | |
if [ ! -S ~/.ssh/ssh_auth_sock ] && [ -S "$SSH_AUTH_SOCK" ]; then | |
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock | |
fi | |
################ | |
## Extra tips ## | |
################ | |
# 1. If your using my older get-ssh-sock.sh/fix-ssh-sock scripts and you want this to work | |
# (without restarting everyting), remove the .bashrc entries and comment everything out | |
# in the fix-ssh-sock script and then add the following line to it | |
# export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock | |
# | |
# 2. If you like to have multiple Putty sessions open at once: connection->ssh->Share SSH connetions | |
# This will prevent issues with one session stepping on another, if you close 1 they all go down. | |
# | |
# 3. If your starting your tmux adcentures from scratch, instead of using the alias entries above you can | |
# instead add the following to your .tmux.conf file | |
# set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment