I have a private proxy which can be either HTTP/SOCKS, and i am renting a Linode server that i use for web-hosting.

If I use a program like putty to SSH onto the webserver and run who it will display the current session and the IP of the proxy(as i used putty set with a proxy)

However, if i am on my home pc (running Kali) and I SSH onto the webserver it will display by home IP.

Basically what I'm asking is, how can i SSH from my Linux machine at home and have it do it via a proxy? I'm aware of ProxyCommand but i cant seem to get it working.

1 Answer 1


I managed to solve this myself with some time and effort so ill post my solution here in hopes that it will save someone some time in the future.

ssh -o ProxyCommand="nc -X connect -x '<proxy ip>:<proxy port>' %h %p" root@<remote ip>

This is the command that im now using to SSH onto my server through my proxy. If you wish to use the same command you might have to run: apt-get install netcat-openbsd in order to run NC with the -X parameter, as the standard installed version doesn't include it.

If your proxy includes or requires authentication then you can provide the username with nc using the -P option. This will prompt you for a password when trying to connect. Although i couldn't get this part working, it didn't seem to accept my password. I just set my proxy to accept any connection from my IP without needed to authenticate.

Hope this saves someone some time in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .