![尝试使用 lighttpd 设置 rTorrent 时出现权限被拒绝的情况](https://linux22.com/image/878674/%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20lighttpd%20%E8%AE%BE%E7%BD%AE%20rTorrent%20%E6%97%B6%E5%87%BA%E7%8E%B0%E6%9D%83%E9%99%90%E8%A2%AB%E6%8B%92%E7%BB%9D%E7%9A%84%E6%83%85%E5%86%B5.png)
我想在本地创建一个 rTorrent RPC 服务器。
我安装了 rTorrent,下面是~/.rtorrent.rc
download_rate = 500
#upload_rate = 150
directory = ~/torrent/data
session = ~/torrent/session
port_range = 6881-6999
port_random = no
check_hash = yes
schedule = watch_directory,15,15,load_start=~/torrent/torrent_active/*.torrent
dht = auto
dht_port = 6880
encryption = allow_incoming,require,require_rc4
scgi_local = /home/vinz243/torrent/rpc.socket
和我的lighttpd.conf
:
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
# "mod_rewrite",
)
server.document-root = "/var/www/html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
server.modules += ( "mod_scgi" )
scgi.server = (
"/RPC2" =>
( "127.0.0.1" =>
(
"socket" => "/home/vinz243/torrent/rpc.socket",
"check-local" => "disable",
"disable-time" => 0, # don't disable scgi if connection fails
)
)
)
当我运行 rTorrent 时,它运行正确,我只在底部看到这几行:
(20:00:31) Using 'epoll' based polling.
(20:00:31) Using 'epoll' based polling.
(20:00:31) Using 'epoll' based polling.
(20:00:31) Closed XMLRPC log.
但是,当我尝试在浏览器中访问时localhost/RPC2
,结果如下/var/log/lighttpd/error.log
:
2015-12-23 19:45:08: (log.c.164) server started
2015-12-23 19:45:29: (mod_scgi.c.1393) connect failed: 7 Permission denied 13 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:29: (mod_scgi.c.2410) fcgi-server disabled: 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:29: (mod_scgi.c.2790) all handlers for /RPC2 on /RPC2 are down.
2015-12-23 19:45:30: (mod_scgi.c.2108) fcgi-server re-enabled: 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:35: (mod_scgi.c.1393) connect failed: 7 Permission denied 13 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:35: (mod_scgi.c.2410) fcgi-server disabled: 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:35: (mod_scgi.c.2790) all handlers for /RPC2 on /RPC2 are down.
2015-12-23 19:45:36: (mod_scgi.c.2108) fcgi-server re-enabled: 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:45: (mod_scgi.c.1393) connect failed: 7 No such file or directory 2 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:45: (mod_scgi.c.2410) fcgi-server disabled: 0 /home/claire/torrent/rpc.socket
2015-12-23 19:45:45: (mod_scgi.c.2790) all handlers for /RPC2 on /RPC2 are down.
2015-12-23 19:45:46: (mod_scgi.c.2108) fcgi-server re-enabled: 0 /home/claire/torrent/rpc.socket
答案1
正确答案
要解决该问题,只需将其添加到您的rtorrent.rc
:
schedule = scgi_permission,0,0,"execute.nothrow=chmod,\"g+w,o=\",/home/user/rtorrent/rpc.socket"
有历史的老答案
rTorrent 很奇怪.. 启动后改变套接字的访问权限文件,导致 lighttpd 无法访问它。
我遇到了同样的问题,目前我只是运行
chmod 777 /home/vinz243/torrent/rpc.socket
每次在 rtorrent 启动后,但我认为,chmod 777
这不是更好的解决方案。
有 github-issue:https://github.com/rakshasa/rtorrent/issues/394
希望,它能对你有帮助。
更新型多巴胺:看起来,这是一个典型的 rtorrent 裸安装问题。
要解决该问题,只需将其添加到您的rtorrent.rc
:
schedule = scgi_permission,0,0,"execute.nothrow=chmod,\"g+w,o=\",/home/user/rtorrent/rpc.socket"