Last night I answered a question from journalist Micah Lee via Twitter where he was looking for the easiest way to make Tor run as a service in Windows. The question is answered in the Tor Project’s FAQ, but I felt the instructions were a little lacking for someone that is non-technical, hence the reason I decided to write this.
Running Tor as a service separately from the Tor Browser has several benefits, most of which is that Tor continues running even when the browser is closed. This lets the user utilize Tor for other services, such as (but not limited to) instant messaging, email, or remotely accessing other computers through the Tor network. It also gives the user easy control over the service, as starting, stopping, restarting, and disabling a service is a trivial matter.
Unfortunately, the Tor Browser Bundle installer for Windows, provided by the Tor Project, does not include an option during installation to configure Tor to run as a Windows service. However, by using the Windows command line interface (CLI) one can instruct tor.exe to install a Windows Service without any additional downloads or advanced configuration.
Installing the Windows Service
Say that Tor Browser is installed in the B:\Tor Browser\ directory and that one has the folder open in the Windows file explorer:
- Go into the Browser\TorBrowser\ directory
- You should see a Tor folder in this directory
- While holding down the ‘Shift’ key, right click the Tor folder
- Select ‘Open command window here’
This will open the Windows CLI already in the context of the B:\Tor Browser\Browser\TorBrowser\Tor\ directory, where tor.exe exists as seen when listing the directory contents:
One can then enter the following command to instruct tor.exe to install a Windows Service:
B:\Tor Browser\Browser\TorBrowser\Tor> tor.exe –service install
That should be it. One can check the service was installed by opening the Windows Services snap-in by holding down the Windows Key while pressing R and typing services.msc into the ‘Open:’ field:
Clicking OK here will cause the Services window to open, which looks like this:
One can then find the ‘Tor Win32 Service’ in the list and view its status, as well as stop, start, or restart the service. It can also be easily configured to not automatically start on Windows boot, if desired.
Configuring other software to utilize the Tor service is beyond the scope of this article, but generally one can now point SOCKS4/5 proxy connections to 127.0.0.1:9050 to direct traffic through this Tor service.