How do I ssh to a hidden service with torsocks? Manual for torsocks says that ssh should work just fine yet it doesn't. It fails with the following:

$ torsocks ssh username@example.onion
get_sock_port: getnameinfo NI_NUMERICSERV failed: ai_family not supported

Complete debugging log here.

Is it even remotely possible to use torsocks in this case?

Sure, if I add an explicit proxy definition to the .ssh/config, ssh to this host works just fine, but I'd prefer to use torsocks because I not always can or want to modify .ssh/config like follows.

Host *.onion
    ProxyCommand /bin/nc.openbsd -xlocalhost:9050 -X5 %h %p

But that's not what I want.

closed as unclear what you're asking by Jens Kubieziel Feb 1 '18 at 13:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    I tried your command and it works with torsocks 2.1.0 perfectly fine. Thatswhy I'll close the question. – Jens Kubieziel Mar 15 '16 at 18:46
  • 1
    "WARNING torsocks[17541]: [connect] Connection to a local address are denied since it might be a TCP DNS query to a local DNS server. Rejecting it for safety reasons." this is happening because you've probably still got ssh configured to use nc to proxy, causing a conflict. do you have any other options set, like are you trying to forward ports or X11? – cacahuatl Jun 16 '16 at 2:00
  • 1
    sure the debug log it isn't, but that specific error is that it's trying to connect to a localhost address and being denied. – cacahuatl Jun 16 '16 at 3:24
  • 1
    @canonizingironize denied by what? apparently it's just works now... With or without nc. – sanmai Jun 16 '16 at 3:36
  • 1
    By torsocks, it hooks certain libc calls and blocks them on the basis that they can't be safely performed without possibly leaking. – cacahuatl Jun 16 '16 at 19:06