Today I found a more elegant way to escape this limitation and still ssh through Tor via Netcat.
Homebrew’s netcat provides version 0.7.1, which doesn’t support proxy so it’s not suitable for our purpose. We will install Nmap’s improved version ncat
brew install nmap tor
This will install both Nmap and Tor. Now, very easily, let’s proxy ssh through Tor by using ProxyCommand:
ssh -o ProxyCommand="ncat --proxy-type socks5 --proxy 127.0.0.1:9050 %h %p" root@dest-host
You can create a convenient shell alias by adding to your ~/.zsh (or ~/.bashrc):
alias torssh='ssh -o ProxyCommand="ncat --proxy-type socks5 --proxy 127.0.0.1:9050 %h %p"