christianmlong + ssh-agent   8

Less Perplexing Terminal Multiplexing with tmux
There are scripts, like this one that will attempt to find ssh-agent’s socket after it has been lost, but I recently discovered that tmux has an option that should save you the trouble. Just add: set -g update-environment -r to your .tmux.conf—it will automatically copy a handful of useful environment variables into new shells from the parent environment.
tmux  ssh-agent  config  dotfiles  tips 
august 2015 by christianmlong
dagit.o: tmux + ssh-agent
30 March 2012
tmux + ssh-agent
Lately I've been using tmux on remote servers. This allows me to maintain task-specific sessions on remote servers, regardless of what computer I work from or if my internet connection get severed.

The biggest wrinkle in my setup has been ssh-agent forwarding. When I reconnect the remote side no longer knows where to find SSH_AUTH_SOCK. I found a solution.

Step 1. On the remote host, create $HOME/.ssh/rc, make it executable, and add the following contents:
1 2 3 4

#!/bin/bash
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi

view raw rc This Gist brought to you by GitHub.

Don't forget: chmod 755 $HOME/.ssh/rc

Step 2. Add these two lines to your .tmux.conf:
1 2

set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock

view raw .tmux.conf This Gist brought to you by GitHub.


A few things kept me from getting this working straight away. You have to disable the default behavior of updating SSH_SOCK_AUTH (that's what the first line does), then you have to set SSH_SOCK_AUTH to point at the symlink created by the script in step 1.
tmux  ssh-agent 
may 2013 by christianmlong
Jim B's Blog: How to add ssh private key to Apple Keychain.
You may need to add your passphrases to the Apple keychain. In the terminal, type:

ssh-add -K ~/.ssh/id_rsa

Or whatever the path to your private key is. Do this for each key. This will put the passphrase in the Apple keychain and you will not be prompted for passphrases. If you do not have a key in the default file (id_rsa or id_dsa), the Apple mechanisms do not seem to automatically prompt you for your passphrases.
osx  keychain  ssh-add  ssh  ssh-agent 
february 2013 by christianmlong

Copy this bookmark:



description:


tags: