3 ms·
Instead of ssh -R 12345:localhost:22 server.com "sleep 1000; exit" use ssh -R 12345:localhost:22 -n server.com The -n flag tells ssh to only make a
by lloeki 12y ago
Instead of
ssh -R 12345:localhost:22 server.com "sleep 1000; exit"
use
ssh -R 12345:localhost:22 -n server.com
The -n flag tells ssh to only make a connection, without ever running a shell. This means it even works when you don't have shell access (say, with a command= entry in .authorized_keys).
Also, I cannot recommend envoy enough in lieu of ssh-agent, if you're not using a GUI ssh agent already (e.g OSX keychain or GNOME keyring)
Last, I guarantee you don't want "$@" in those aliases, but either "$*" or $@ (certainly the latter).
- zipperhead 12y agoI usually visit these threads knowing that I will pick up something useful to add to the toolbox... thank you for 'envoy' - I think it will streamline my ssh key management.
- ciupicri 12y agoI think you meant -N, not -n. From the man page[1]: -N Do not execute a remote command. This is useful for just for‐ warding ports (protocol version 2 only). -n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in the background. [1]: http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1 http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1