Both SSH server and Tails client are running on the same wired network. There is no problem SSH from other machines on the same network to the SSH server.

Got the following ERROR:

connection failed, SOCKS error 1
ssh_exchange_identification: Connection closed by remote host

Tried most of the online solutions, but still doesn't work.

  • By "the same wired network" do you means LAN? If so, is the address you're trying to ssh to it as a private IP address (e.g. in one of these ranges: If it's not, it will try to connect to it over Tor.
    – cacahuatl
    Commented Jul 14, 2017 at 16:12
  • 1
    They all have public IPs but only accept SSH connections from IPs within a particular range. I think when SSH goes through TOR, the SSH server considers the connection from the exit node, whose IP is not in that range. I will use private IPs for the SSH between these machines.
    – Amy Yu
    Commented Jul 15, 2017 at 4:42

1 Answer 1


The issue is that Tails' ssh config will try to use Tor to connect to any internet routable address, with exceptions set for private IP ranges.

Since you're referencing the public address, ssh is trying to use Tor to connect but since the destination only accepts connections from other devices on the same network, it cannot establish a Tor connection.

Tails' iptables configuration would also mean that even if ssh wasn't trying to proxy the connection over Tor, a connection to an internet address that wasn't made through Tor would be dropped.

You could setup an onion to provide ssh access over Tor (even a single-hop-onion to improve latency, since the server doesn't need location anonymity) which would allow you to ssh to it from Tails, otherwise you'd need to be able to route to it from a private IP range, specifically one of:, or

You must log in to answer this question.

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