gpt4 book ai didi

tor -/var/lib/tor 无法读取 : Permission denied or Couldn't create private data directory

转载 作者:行者123 更新时间:2023-12-04 09:35:42 25 4
gpt4 key购买 nike

我使用google cloud shell来执行这个程序

  1. Linux 版本
    Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
  1. Tor 版本 0.3.5.10。

  2. 当我尝试重新启动“sudo service tor restart”Tor 时,我收到错误消息

[ ok ] Stopping tor daemon...done (not running - there is no /run/tor/tor.pid).
[....] Starting tor daemon...Jun 27 01:51:04.132 [warn] Directory /var/lib/tor cannot be read: Permission denied
Jun 27 01:51:04.132 [warn] Failed to parse/validate config: Couldn't create private data directory "/var/lib/tor"
Jun 27 01:51:04.132 [err] Reading config failed--see warnings above.
failed.
  1. 所以我为tor目录设置了完全权限sudo chmod -R 777/var/lib/tor

    [FAIL] Checking if tor configuration is valid ... failed!
    Jun 27 01:53:59.685 [notice] Tor 0.3.5.10 running on Linux with Libevent 2.1.8-stable, OpenSSL 1.1.1g, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd 1.3.8.
    Jun 27 01:53:59.685 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
    Jun 27 01:53:59.685 [notice] Read configuration file "/usr/share/tor/tor-service-defaults-torrc".
    Jun 27 01:53:59.685 [notice] Read configuration file "/etc/tor/torrc".
    Jun 27 01:53:59.688 [warn] Error setting groups to gid 114: "Operation not permitted".
    Jun 27 01:53:59.688 [warn] If you set the "User" option, you must start Tor as root.
    Jun 27 01:53:59.688 [warn] Failed to parse/validate config: Problem with User value. See logs for details.
    Jun 27 01:53:59.688 [err] Reading config failed--see warnings above.
  2. 我使用root权限sudo su

    [ ok ] 正在停止 tor 守护进程...完成(未运行 - 没有/run/tor/tor.pid)。[....] 启动 tor 守护进程...Jun 27 01:58:58.455 [警告] 无法读取目录/var/lib/tor:权限被拒绝Jun 27 01:58:58.455 [警告] 无法解析/验证配置:无法创建私有(private)数据目录“/var/lib/tor”Jun 27 01:58:58.455 [错误] 读取配置失败——请参阅上面的警告。

有什么方法可以帮助我解决我的问题,或者我怎样才能安装 tor 版本 2.9.14?

最佳答案

你现在可能已经解决了这个问题,如果还没有,我希望这能对你有所帮助。


有什么方法可以帮我解决问题吗?

选项 1

让我们来看看这些警告:

[warn] Error setting groups to gid 114: "Operation not permitted".
[warn] If you set the "User" option, you must start Tor as root.
[warn] Failed to parse/validate config: Problem with User value.

要获取所有用户的日志,请运行 cat/etc/passwd,您会看到列出了 debian-tor:

...
debian-tor:x:108:114::/var/lib/tor:/bin/false
...

文件夹 /var/lib/tor 归用户 debian-tor 所有,所以 sudo -u debian-tor tor 将起作用.

或者,您可以为当前用户运行此命令:(或为所有用户运行 chmod 777)

chmod 700 -R /var/lib/tor/*
chown -R tor /var/lib/tor/
sudo service tor restart

您实际上应该以非 root 身份运行 tor,否则您会收到此消息:

You are running Tor as root. You don't need to, and you probably shouldn't.

选项 2

正如警告建议查看日志以获取详细信息,您应该检查dsmeg/var/log/syslog 中的消息。如果您发现任何东西,那么它可能是 AppArmor 或 SELinux 阻塞器。 SELinux 和 AppArmor 都提供了一套工具来将应用程序彼此隔离,以保护主机系统免受损害,因此不建议永久禁用它们,而是暂时禁用它们进行调试。

根据 Debian SELinux support :

The Debian packaged Linux kernels have SELinux support compiled in,but disabled by default.

使用 getenforce 检查 SELinux 状态,如果输出是 Permissive 或 Disabled,那么你就设置好了。

此外,查看AppArmor/Progress :

Since Debian 10 (Buster), AppArmor is enabled by default.

要在您的系统上禁用 AppArmor,请运行:( reference )

sudo mkdir -p /etc/default/grub.d
echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=0"' \
| sudo tee /etc/default/grub.d/apparmor.cfg
sudo update-grub
sudo reboot

两者都有可能是罪魁祸首。用户已报告类似问题 here .


我怎样才能安装 tor 版本 2.9.14?

降级tor包就这么简单:

sudo apt-get install tor=0.2.9.14

但是你为什么要这样做呢?

tor v2 将是 deprecated很快。您会看到如下警告:

[warn] At least one protocol listed as required in the consensus is
not supported by this version of Tor. You should upgrade. This version
of Tor will not work as a client on the Tor network. The missing
protocols are: DirCache=2 HSDir=2 HSIntro=4 Link=4-5

注意:发布于tor.stackexchange与 tor 相关的问题。

关于tor -/var/lib/tor 无法读取 : Permission denied or Couldn't create private data directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62605111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com