[英]setsockopt for systemd unit - error: "Operation not permited"
I'm trying to run BindToInterface in a script as part of a systemd service that runs under its own separate user.我正在尝试在脚本中运行BindToInterface作为在其自己的单独用户下运行的 systemd 服务的一部分。
The service file looks like this:服务文件如下所示:
[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target mnt-storage.mount
Requires=mnt-storage.mount
BindsTo=mnt-storage.mount
[Service]
Type=simple
UMask=000
ExecStart=/bin/bash /media/bti/deluged.sh
Restart=on-failure
# Time to wait before forcefully stopped.
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
The script is as follows:脚本如下:
#!/bin/bash
BIND_INTERFACE=eno2 DNS_OVERRIDE_IP=8.8.8.8 BIND_EXCLUDE=127.0.0.1,192.168. LD_PRELOAD=/media/bti/bindToInterface.so /usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
when executing:执行时:
systemctl status deluged
I get the following output:我得到以下输出:
bash[503711]: setsockopt: Operation not permitted
Is there a way to run your tool without elevated privileges?有没有办法在没有提升权限的情况下运行您的工具? How would "setsockopt" be run for a systemd unit without elevated privileges
如何在没有提升权限的情况下为 systemd 单元运行“setsockopt”
Thanks谢谢
Linux 作为一个严格的限制:只有 root 可以打开 1024 以下的端口。如果你的守护进程这样做,你只能由 root 来执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.