Setting up a second instance of Tor

1. init script

cp /etc/init.d/tor /etc/init.d/tor2

Edit it:

...
NAME=tor2
DESC="tor2 daemon"
TORPIDDIR=/var/run/tor
TORPID=$TORPIDDIR/tor2.pid
DEFAULTSFILE=/etc/default/tor # $NAME
WAITFORDAEMON=60
DEFAULT_ARGS="--defaults-torrc /etc/tor2/tor-service-defaults-torrc -f /etc/tor2/torrc"
...

2. etc dir

cp -R /etc/tor /etc/tor2

Edit /etc/tor2/torrc to change ports/nickname/etc.

You will also need to redefine SocksPort and ControlPort, add:

SocksPort 9051
ControlPort 9052

3. tor-service-defaults-torrc

cp /usr/share/tor/tor-service-defaults-torrc /etc/tor2/

Edit /etc/tor2/tor-service-defaults-torrc:

DataDirectory /var/lib/tor2
PidFile /var/run/tor/tor2.pid
...
ControlSocket /var/run/tor/control2
...
CookieAuthFile /var/run/tor/control2.authcookie

Log notice file /var/log/tor/log2

4. data dir

mkdir /var/lib/tor2
chown -R debian-tor:debian-tor /var/lib/tor2

5. start-up

Into /etc/rc.local:

/etc/init.d/tor2 start

tor2.txt · Last modified: 2015-08-04 14:26 UTC by rm