A Blog about technology, linux, peer2peer, cool new downloads and software development.

Tuesday, February 10, 2009

SSH reverse tunnel (Detached & Persistent)

nohup bash -c "while [ 1 ]; do ssh -o ExitOnForwardFailure=yes -o ConnectTimeout=2 -o TCPKeepAlive=yes -o ServerAliveInterval=2 -o ServerAliveCountMax=2 -N -R 2222:localhost:22 user@server.com; sleep 1; done" &

(after authorizing key with ssh-copy-id)
Example : run on boot of virtual machine that has a dynamic ip - connect via : ssh localhost:2222

No comments: