long running ssh function without tying up a term?

Tom Horsley horsley1953 at gmail.com
Mon Sep 16 00:29:10 UTC 2013


On Sun, 15 Sep 2013 20:16:15 -0400
bruce wrote:

> sshpass -p pass ssh -R 2000:localhost:22 user at foo.com -p 50122
> 
> -creates the initial reverse ssh, but it leaves the opened
> term/connection as well

You need the -N option on ssh for no terminal, just
create forwarded connections.

I've got a background job running on my system at
work in a loop that has its own copy of an ssh-agent
to stash the keys and loops running ssh -N to forward
a bunch of ports to my home system and sleep 30
seconds and try again if the ssh dies because it lost
the connection.

(I also have fanatical big public keys and firewall
rules to make sure only a system from work can connect to
home :-).


More information about the users mailing list