My long-time reader Lars Timmann pointed me to a another really cool usecase of the /dev/tcp pseudo device in the bash shell. You can use it to proxy ssh connections though a jump host without the need to have nc on it. He writes in a Facebook comment:
I use it in ~/.ssh/config like this:
--------------X8------------------------------------------
Host host-a
ProxyCommand ssh host-b "/bin/bash -c 'exec 3<>/dev/tcp/%h/%p; cat <&3 & cat >&3;'"
--------------X8------------------------------------------
So there i no need for netcat on any host to use it as jump host :-).

3 Comments

Linear

  • Alex  
    This in not needed anymore with introduction of:

    "ssh(1): Add a ProxyJump option and corresponding -J command-line flag to allow simplified indirection through a one or more SSH bastions or "jump hosts".

    http://www.openssh.com/txt/release-7.3

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA