Am rather disappointed that mbuffer isn’t shipped in CentOS 7. Easy enough to install, but seriously useful to have updated software in this day in age.
Anyhow, to use mbuffer for a long transfer where an outgoing connection was the only option, I finally found a situation where I wanted to use a fifo.
dmzhost$ mkfifo /tmp/tarfifo
lanhost$ ssh dmzhost "cat /tmp/tarfifo" | mbuffer -P90 -m512M | tar xf -
dmzhost$ tar cf - pub | mbuffer -P90 -m128M > /tmp/tarfifo
And there we have it.
The first thing my .bash_aliases file does on login is to check if I’m running ssh-agent and if so, stick that into my shell environment. If not, kick it up, and update a reminder to it. This morning I found a flaw in that, so I believe this is the fix.
4 export SSH_RECENT="$HOME/.ssh/recent"
5 [ -f "$SSH_RECENT" ] && eval `cat $SSH_RECENT`
7 if [ ! -z "$SSH_AGENT_PID" ]
9 RUNNING_AGENTS=`pgrep -u $(id -u) ssh-agent | grep $SSH_AGENT_PID | wc -l`
11 if [ $RUNNING_AGENTS -lt 1 -a $UID -ne 0 ]
13 eval `ssh-agent`
14 echo "export SSH_AGENT_PID=$SSH_AGENT_PID" > $SSH_RECENT
15 echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $SSH_RECENT
17 [ `ssh-add -l | fgrep -v ' no ' | wc -l` -eq 0 ] && ssh-add
Years ago when I first stared listening to podcasts when I had barely worked at PRWeb for a year even, I came up with a piece of shell script to automatically start up an ssh-agent and ask for your passphrase.
Unfortunately, the code created tons of ssh-agents, which was unfortunate.
Here is a version that behaves much better:
2 export SSH_RECENT="$HOME/.ssh/recent"
3 [ -f $SSH_RECENT ] && eval `cat $SSH_RECENT`
5 if [ ! -z "$SSH_AGENT_PID" ]
7 RUNNING_AGENTS=`ps -p $SSH_AGENT_PID | grep -v CMD | wc -l`
9 if [ $RUNNING_AGENTS -lt 1 -a $UID -ne 0 ]
11 eval `ssh-agent`
12 echo "export SSH_AGENT_PID=$SSH_AGENT_PID" > $SSH_RECENT
13 echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $SSH_RECENT
16 [ `ssh-add -l | fgrep -v ' no ' | wc -l` -lt 1 ] && ssh-add
Can you tell me why I’m choosing to evaluate $UID for zero?
And, will this work if I switch from an Xterm to a virtual terminal?
This looks like a good guide on using ssh-keygen, the authorized_keys file, and using ssh-agent.
OpenSSH Public Key Authentication.