tor 从引用错误位置的源 torrc 文件构建

tor build from source torrc file referencing wrong location

我正在使用 arch linux 并从源代码构建 tor。以下命令用于从源代码构建。

 mkdir -p ~/Download/Torbinary

# this used to manual copy the binary after make install.
./configure --prefix=~/Download/Torbinary
make
make install

在上述步骤之后,我将创建一个监狱并将所有必需的二进制文件和库从 ~/Download/Torbinary 添加到文件夹和文件中。

我的监狱位于 /opt/torjail

当我运行 tor 程序使用

sudo chroot --userspec=tor:tor /opt/torjail /bin/tor

正在寻找里面的torrc文件~/Download/Torbinary/etc/tor/torrc

但是如果我手动指定 -f 选项,如下所示。这行得通。

sudo chroot --userspec=tor:tor /opt/torjail /bin/tor -f /etc/tor/torrc

附上我遇到的错误

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.

请告诉我我缺少什么。

您可以创建文件/home/vipin/Download/Torbinary/etc/tor/torrc

mkdir -p /home/vipin/Download/Torbinary/etc/tor
touch /home/vipin/Download/Torbinary/etc/tor/torrc

而不是将 DataDirectory 设置为您的 /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