I am using arch linux and build tor from the source . Below commands are used for to build from source.
mkdir -p ~/Download/Torbinary
# this used to manual copy the binary after make install.
./configure --prefix=~/Download/Torbinary
make
make install
After the above step i am create a jail and adding the all required binary and library from ~/Download/Torbinary to folders and files.
My jail is located under /opt/torjail
When i am running the tor program using
sudo chroot --userspec=tor:tor /opt/torjail /bin/tor
it is looking for the torrc file inside ~/Download/Torbinary/etc/tor/torrc
But if i manual specify -f option like below. it work.
sudo chroot --userspec=tor:tor /opt/torjail /bin/tor -f /etc/tor/torrc
Attaching the error i was getting
Dec 31 22:15:21.556 [notice] Tor 0.4.2.5 running on Linux with Libevent 2.1.11-stable, OpenSSL 1.1.1d, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd 1.4.4.
Dec 31 22:15:21.556 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Dec 31 22:15:21.556 [notice] Configuration file "/home/vipin/Download/Torbinary/etc/tor/torrc" not present, using reasonable defaults.
Dec 31 22:15:21.557 [notice] Opening Socks listener on 127.0.0.1:9050
Dec 31 22:15:21.557 [notice] Opened Socks listener on 127.0.0.1:9050
Dec 31 22:15:21.557 [warn] Error creating directory /root/.tor: No such file or directory
Dec 31 22:15:21.557 [warn] Failed to parse/validate config: Couldn't create private data directory "/root/.tor"
Dec 31 22:15:21.557 [err] Reading config failed--see warnings above.
Please tell me what i am missing.
You can create file /home/vipin/Download/Torbinary/etc/tor/torrc
mkdir -p /home/vipin/Download/Torbinary/etc/tor
touch /home/vipin/Download/Torbinary/etc/tor/torrc
than set DataDirectory
to your /home/vipin/Download/Torbinary/etc/tor/torrc
## 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
DataDirectory /opt/torjail/tor-data