I'm having a hard time understanding why torsocks/torify isn't working in this particular case.

 torify ssh user@remotemachine
 torsocks ssh user@remotemachine

When I do the following command when I get in my actual IP is printed:

# [my actual IP + remote/local ports]

But if I do

ssh -o ProxyCommand='nc -x localhost:9050 %h %p' user@remotemachine # 9050 being the SOCKSPort

then I get the tor ip. What gives? What am I missing about how torify/torsocks and/or ssh works?

Contents of torsocks.conf:

TorPort 9050              # matches tor's SOCKSPort

edit: I should mention that I'm on MacOS and cannot torify/torsocks /usr/bin/ssh directly since /usr/bin is protected by Apple's System Integrity Protection so I copy it into /tmp/ssh first. I don't imagine that would change anything but don't know what I don't know so...

2 Answers 2


Try to use full path to your ssh copy like this:

torify /tmp/ssh user@remotemachine
torsocks /tmp/ssh user@remotemachine
  • I do that already. The code I put in my question was the simplest presentation of the problem (perhaps too simplified). I'm not at all familair with Apple's System Integrity Protection system but it prevents binaries in /usr/bin (like curl and ssh) from being used with torify/torsocks. Oct 21, 2018 at 15:05
  • I don't know Apple at all but maybe /tmp is not the best choice for exeutables. Have you checked this: lorenzo.mile.si/…?
    – Tomek
    Oct 21, 2018 at 15:26

From HowToForge:

Add this to your ~/.ssh/config/

Host anon_*
CheckHostIP no
Compression yes
Protocol 2
ProxyCommand connect -4 -S localhost:9050 $(tor-resolve %h localhost:9050) %p
Host anon_mydomain
HostName mydomain.com
User myaccount
Host anon_mydomain2
HostName mydomain2.com
User myaccount
Port 980

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.