'ssh -R 12345:localhost:22 server.com "sleep 1000; exit"' forwards server.com's port 12345 to your local ssh port, even if you machine is not externally visible on the net.
This one blew my mind
This one blew my mind
ssh -fN -o ServerAliveInterval="240" -R 2222:localhost:22 example.com
(And on example.com ssh -p 2222 localhost)This lets you easily keep the tunnel open long-term. Why?
-f Background the ssh process (don't need nohup)
-N Don't run any command
-o... Make ssh do the work of keeping the session alive forever'sshfs_mount' is not really stable, any network failure will be troublesome'
To avoid trouble with remote backups and other long running processes, I always add the following to the end of ~/.ssh/config or /etc/ssh_config:
Host *
ServerAliveInterval 300 while [ true ]; do sleep 1000; done
Just using: sleep 1000; exit
means you can't make new connections after 17 minutes.I enjoyed your list.