0

I have a problem with my tor service. Whenever I start tor with command tor then it works and gives me the normal expected output (hidden service is running aswell).

Nov 05 18:34:45.896 [notice] Tor 0.2.9.11 (git-aa8950022562be76) running on Linux with Libevent 2.0.21-stable, OpenSSL 1.0.2g and Zlib 1.2.8.
Nov 05 18:34:45.896 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Nov 05 18:34:45.896 [notice] Read configuration file "/etc/tor/torrc".
Nov 05 18:34:45.900 [notice] Opening Socks listener on 127.0.0.1:9050
Nov 05 18:34:45.000 [notice] Parsing GEOIP IPv4 file /usr/share/tor/geoip.
Nov 05 18:34:46.000 [notice] Parsing GEOIP IPv6 file /usr/share/tor/geoip6.
Nov 05 18:34:46.000 [warn] You are running Tor as root. You don't need to, and you probably shouldn't.
Nov 05 18:34:46.000 [notice] Bootstrapped 0%: Starting
Nov 05 18:34:46.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Nov 05 18:34:47.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Nov 05 18:34:47.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Nov 05 18:34:48.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Nov 05 18:34:48.000 [notice] Bootstrapped 100%: Done

But whenever I try to run it as a daemon then my hidden service won't start.

/etc/tor/torrc

#SOCKSPort 9050 # Default: Bind to localhost:9050 for local connections.
#SOCKSPort 192.168.0.1:9100 # Bind to this address:port too.

#SOCKSPolicy accept 192.168.0.0/16
#SOCKSPolicy accept6 FC00::/7
#SOCKSPolicy reject *

Log notice file /var/log/tor/notices.log
Log debug file /var/log/tor/debug.log
#Log notice syslog
#Log debug stderr

#RunAsDaemon 1

## The directory for keeping all the keys/etc. By default, we store
## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
DataDirectory /var/lib/tor

#ControlPort 9051

#CookieAuthentication 1

###########################################

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:1337

###########################################

#ORPort 443 NoListen
#ORPort 127.0.0.1:9090 NoAdvertise


#Address noname.example.com

#OutboundBindAddressExit 10.0.0.4
#OutboundBindAddressOR 10.0.0.5

#Nickname ididnteditheconfig

#RelayBandwidthRate 100 KBytes  # Throttle traffic to 100KB/s (800Kbps)
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)


#AccountingMax 40 GBytes
#AccountingStart day 00:00
#AccountingStart month 3 15:00

#ContactInfo Random Person <nobody AT example dot com>
#ContactInfo 0xFFFFFFFF Random Person <nobody AT example dot com>


#DirPort 9030 # what port to advertise for directory connections

#DirPort 80 NoListen
#DirPort 127.0.0.1:9091 NoAdvertise
#DirPortFrontPage @CONFDIR@/tor-exit-notice.html

#MyFamily $keyid,$keyid,...

#ExitPolicy accept *:6660-6667,reject *:* # allow irc ports on IPv4 and IPv6 but no more
#ExitPolicy accept *:119 # accept nntp ports on IPv4 and IPv6 as well as default exit policy
#ExitPolicy accept *4:119 # accept nntp ports on IPv4 only as well as default exit policy
#ExitPolicy accept6 *6:119 # accept nntp ports on IPv6 only as well as default exit policy
#ExitPolicy reject *:* # no exits allowed

#BridgeRelay 1
#PublishServerDescriptor 0

#%include /etc/torrc.d/
#%include /etc/torrc.custom
1

1 Answer 1

0

I actually fixed my issue by editing the tor.service file in /lib/systemd/system.

I edited the ExecStart.

Original: ExecStart=/bin/true

New: ExecStart=/usr/sbin/tor -f /etc/tor/torrc

1
  • That's not a good idea, the /bin/true is there but tor actually runs as the tor@default.service, which launches Tor. Your "solution" will remove hardening from the systemd service and stop tor from loading it's torrc-defaults file, which results in it running as root, which is definitely not recommended.
    – cacahuatl
    Nov 5, 2017 at 21:40

You must log in to answer this question.

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