How to open Tor on port 9050?

Hi,
I’ve been following this guide to make tor work on Nixos (I’m using Nixos 20.03).
However, if I put in my configuration.nix:

services.tor.enable = true;

sudo lsof -i -P -n | grep LISTEN doesn’t show port 9050 open.
If I put:

services.tor.enable = true;
services.tor.client.enable = true;

then lsof shows both 9050 and 9063 open:

tor       23406        tor    6u  IPv4 792647      0t0  TCP 127.0.0.1:9050 (LISTEN)
tor       23406        tor    7u  IPv4 792648      0t0  TCP 127.0.0.1:9063 (LISTEN)

Why is that happening? Shouldn’t services.tor.enable open port 9050 and services.tor.client.enable open port 9063? Why do I need both lines?

There are cases where one wants to run the tor service but not expose the SOCKS proxy on 9050, for example when only using that tor instance for hosting a hidden service.

The way the wiki article is written seems to be misleading, because it implies that a proxy would always run. Which is contrary to what the docs for services.tor.enable say:

Enable the Tor daemon. By default, the daemon is run without relay, exit, bridge or client connectivity.

2 Likes