Debian12 运行 v2ray 显示“/etc/systemd/system/v2ray.service:7: Special user nobody configured……” 错误。
这是因为 User=nobody 不安全,而被 systemd 阻止了,解决方法很简单,修改下 v2ray.service 文件就好了。
vi /etc/systemd/system/v2ray.service
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target
[Service]
#User=nobody
DynamicUser=true
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
上面 User=nobody 改成 DynamicUser=true 就好了。
重载一下 systemd:
systemctl daemon-reload
重启一下 v2ray:
systemctl restart v2ray