Skip to content

Instantly share code, notes, and snippets.

@DamnedFacts
Last active November 30, 2020 15:26
Show Gist options
  • Save DamnedFacts/eda49e6f00396cdef92f96568c3a63c2 to your computer and use it in GitHub Desktop.
Save DamnedFacts/eda49e6f00396cdef92f96568c3a63c2 to your computer and use it in GitHub Desktop.
Cool way to use Bash in an SSH proxy if nc (netcat) is not on the remote system, or if the remote host does not support ProxyJump. Use in your ~/.ssh/config file.
Host *
# Cool one-liner. Use bash to connect to ssh host on port 22 and use shell to read/write data!
# https://www.commandlinefu.com/commands/view/14406/read-and-write-to-tcp-or-udp-sockets-with-common-bash-tools
ProxyCommand ssh -q joesmith@remotehost 'host=%h;exec 7<>/dev/tcp/${host}/22; cat <&7 & cat >&7; exec 7>&-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment