I did setup and V3 hidden service for ssh but I'm not able to connect to the server through tor. When I run torify ssh USER@MYHIDDENSERVICEADDRESS.onionI get the following error:

1639811611 ERROR torsocks[44305]: General SOCKS server failure (in socks5_recv_connect_reply() at socks5.c:527)
ssh: connect to host MYHIDDENSERVICEADDRESS.onion port 22: Connection refused

I don't know why it's not working. I added the authentication file to var/lib/tor/hidden_service_ssh/USER/authorized_clients and also configured /var/lib/tor/onion_auth according to this guide (which worked for another hidden service).

I read somewhere that torsocks is depreciated since hidden service V3 but I'm not sure how to deal with it if that is the case.

  • Did you make sure that the SSH service is running on your hidden host ? Is the firewall set up to allow connections to port 22 ?
    – Kate
    Dec 18, 2021 at 15:56
  • Try to setup plain hidden service first - without client authorization. When you have this working - add the client authorization.
    – Tomek
    Dec 18, 2021 at 18:25
  • @Anonymous yes, it is running and the firewall is properly setup. I checked again
    – zerotobtc
    Dec 20, 2021 at 6:23
  • @Tomek The thing is, that the authorization works, but only in the tor browser. When I go to the .onion-site I am asked to enter the private key. However I don't want to enter the private key manually. So I set up the client authorization by adding the private key (with descriptor etc) in /var/lib/tor/onion_auth/ on my local machine. But when I try to restart tor, I get the error above. So the .onion-service works but I don't get the ClientOnionAuthDir running...
    – zerotobtc
    Dec 20, 2021 at 6:55

2 Answers 2


I would suggest to use the ssh proxycommand instead of torify:

ssh -o ProxyCommand='nc -x %h %p' user@hiddenservice

The only right&true way to solve this is to use Tor's on-flight host mappings and TransPort embedded in your firewall rules. It will fix not just SSH and SCP, but will aid literally any regular tool you'll use. Try it - and feel free to ask if you need more help!

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.