Last active
November 30, 2020 15:26
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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