[BUG] sftp 存储无法列出远程 OpenWRT 系统上的 /etc 目录
请确认以下事项
-
[x] 我已确认阅读并同意 AGPL-3.0 第15条 。 本程序不提供任何明示或暗示的担保,使用风险由您自行承担。
-
[x] 我已确认阅读并同意 AGPL-3.0 第16条 。 无论何种情况,版权持有人或其他分发者均不对使用本程序所造成的任何损失承担责任。
-
[x] 我确认我的描述清晰,语法礼貌,能帮助开发者快速定位问题,并符合社区规则。
-
[x] 我已确认阅读了OpenList文档。
-
[x] 我已确认没有重复的问题或讨论。
-
[x] 我已确认是
OpenList的问题,而不是其他原因(例如 网络 ,依赖或操作)。 -
[x] 我认为此问题必须由
OpenList处理,而非第三方。 -
[x] 我已确认这个问题在最新版本中没有被修复。
OpenList 版本(必填)
v4.0.8
使用的存储驱动(必填)
sftp
问题描述(必填)
添加的 sftp 存储,无法读取远程 /etc 目录,其他目录都正常。 同样的配置在 alist 3.40.0 上是没有这个问题的。
配置文件内容(必填)
openlist 配置
{
"force": false,
"site_url": "",
"cdn": "",
"jwt_secret": "aaabbbccc",
"token_expires_in": 48,
"database": {
"type": "postgres",
"host": "127.0.0.1",
"port": 5432,
"user": "postgres",
"password": "",
"name": "postgres",
"db_file": "data/data.db",
"table_prefix": "x_",
"ssl_mode": "disable",
"dsn": ""
},
"meilisearch": {
"host": "http://localhost:7700",
"api_key": "",
"index_prefix": ""
},
"scheme": {
"address": "0.0.0.0",
"http_port": 0,
"https_port": -1,
"force_https": false,
"cert_file": "",
"key_file": "",
"unix_file": "data/openlist.sock",
"unix_file_perm": "650",
"enable_h2c": false
},
"temp_dir": "data/temp",
"bleve_dir": "data/bleve",
"dist_dir": "",
"log": {
"enable": false,
"name": "data/log/log.log",
"max_size": 50,
"max_backups": 30,
"max_age": 28,
"compress": false
},
"delayed_start": 0,
"max_connections": 0,
"max_concurrency": 64,
"tls_insecure_skip_verify": false,
"tasks": {
"download": {
"workers": 5,
"max_retry": 1,
"task_persistant": false
},
"transfer": {
"workers": 5,
"max_retry": 2,
"task_persistant": false
},
"upload": {
"workers": 5,
"max_retry": 0,
"task_persistant": false
},
"copy": {
"workers": 5,
"max_retry": 2,
"task_persistant": false
},
"move": {
"workers": 5,
"max_retry": 2,
"task_persistant": false
},
"decompress": {
"workers": 5,
"max_retry": 2,
"task_persistant": false
},
"decompress_upload": {
"workers": 5,
"max_retry": 2,
"task_persistant": false
},
"allow_retry_canceled": false
},
"cors": {
"allow_origins": [
"*"
],
"allow_methods": [
"*"
],
"allow_headers": [
"*"
]
},
"s3": {
"enable": false,
"port": 5246,
"ssl": false
},
"ftp": {
"enable": false,
"listen": ":5221",
"find_pasv_port_attempts": 50,
"active_transfer_port_non_20": false,
"idle_timeout": 900,
"connection_timeout": 30,
"disable_active_mode": false,
"default_transfer_binary": false,
"enable_active_conn_ip_check": true,
"enable_pasv_conn_ip_check": true
},
"sftp": {
"enable": false,
"listen": ":5222"
},
"last_launched_version": "v4.0.8"
}
远程配置
{
"id": 13,
"mount_path": "/OpenWRT",
"order": 0,
"driver": "SFTP",
"cache_expiration": 0,
"status": "work",
"addition": "{\"address\":\"192.168.6.1:22\",\"username\":\"root\",\"private_key\":\"\",\"password\":\"aaabbbccc\",\"passphrase\":\"\",\"root_folder_path\":\"/\",\"ignore_symlink_error\":true}",
"remark": "",
"modified": "2024-07-04T23:06:48.880397353Z",
"disabled": false,
"enable_sign": false,
"order_by": "",
"order_direction": "",
"extract_folder": "",
"web_proxy": false,
"webdav_policy": "native_proxy",
"proxy_range": false,
"down_proxy_url": ""
}
日志(可选)
Jul 08 09:32:59 server openlist[156961]: failed get objs
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/runtime/asm_amd64.s:1700
Jul 08 09:32:59 server openlist[156961]: runtime.goexit
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/net/http/server.go:2102
Jul 08 09:32:59 server openlist[156961]: net/http.(*conn).serve
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/net/http/server.go:3301
Jul 08 09:32:59 server openlist[156961]: net/http.serverHandler.ServeHTTP
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:600
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Engine).ServeHTTP
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:644
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:249
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.LoggerWithConfig.func1
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/middlewares/check.go:30
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/middlewares.StoragesLoaded
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/middlewares/auth.go:73
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/middlewares.Auth
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/handles/fsread.go:88
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/handles.FsList
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/fs.go:27
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.List
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/list.go:25
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.list
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/op/fs.go:132
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/op.List
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:108
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).Do
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:195
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).doCall
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:193
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).doCall.func2
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/op/fs.go:135
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/op.List.func1
Jul 08 09:32:59 server openlist[156961]: failed to list objs
Jul 08 09:32:59 server openlist[156961]: ERRO[2025-07-08 09:32:59] failed list /OpenWRT/etc: file does not exist
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/runtime/asm_amd64.s:1700
Jul 08 09:32:59 server openlist[156961]: runtime.goexit
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/net/http/server.go:2102
Jul 08 09:32:59 server openlist[156961]: net/http.(*conn).serve
Jul 08 09:32:59 server openlist[156961]: /opt/hostedtoolcache/go/1.24.4/x64/src/net/http/server.go:3301
Jul 08 09:32:59 server openlist[156961]: net/http.serverHandler.ServeHTTP
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:600
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Engine).ServeHTTP
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:644
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:249
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.LoggerWithConfig.func1
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/middlewares/check.go:30
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/middlewares.StoragesLoaded
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/middlewares/auth.go:73
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/middlewares.Auth
Jul 08 09:32:59 server openlist[156961]: /home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/handles/fsread.go:88
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/handles.FsList
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/fs.go:27
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.List
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/list.go:25
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.list
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/op/fs.go:132
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/op.List
Jul 08 09:32:59 server openlist[156961]: github.com/gin-gonic/gin.(*Context).Next
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/server/handles/fsread.go:88
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/server/handles.FsList
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/fs.go:27
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.List
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/fs/list.go:25
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/fs.list
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/op/fs.go:132
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/op.List
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:108
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).Do
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:195
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).doCall
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/pkg/singleflight/singleflight.go:193
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/pkg/singleflight.(*Group[...]).doCall.func2
Jul 08 09:32:59 server openlist[156961]: /home/runner/work/OpenList/OpenList/internal/op/fs.go:135
Jul 08 09:32:59 server openlist[156961]: github.com/OpenListTeam/OpenList/v4/internal/op.List.func1
Jul 08 09:32:59 server openlist[156961]: failed to list objs
Jul 08 09:32:59 server openlist[156961]: ERRO[2025-07-08 09:32:59] fs/list: file does not exist
复现链接(可选)
No response
感谢您联系OpenList。我们会尽快回复您。 Thanks for contacting OpenList. We will reply to you as soon as possible.
进一步测试,访问 debian 服务器 sftp 服务是正常的。 目前只在 openwrt 上碰到此问题,尝试升级 openssh-sftp-server 到 9.8p1-2 版本后也无效。
直接使用 sftp [email protected] 命令连接,是可以正常列出 /etc 目录的。
似乎把你的/etc当成一个文件了,你访问/OpenWRT/etc/试试
另外,可以在Openwrt下执行以下ls -l /看一下
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
op应该已经很久不使用dropbear了
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
op应该已经很久不使用dropbear了
不,起码我的还是,而且在dropbear下一模一样的问题。我正在重装openssh取代再试一遍
似乎把你的/etc当成一个文件了,你访问
/OpenWRT/etc/试试 另外,可以在Openwrt下执行以下ls -l /看一下
/etc/ 和 /etc 下面所有的子目录也是一样的报错。Openwrt 终端进去 ls -l 一切正常。
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
op应该已经很久不使用dropbear了
不,起码我的还是,而且在dropbear下一模一样的问题。我正在重装openssh取代再试一遍
换了openssh后问题依旧⊙﹏⊙∥
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
我同时跑着 alist 3.40.0,一样的配置,访问 /etc 是没有问题的。要不然我发帖是不敢点“我认为此问题必须由OpenList处理“的。
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
我同时跑着 alist 3.40.0,一样的配置,访问 /etc 是没有问题的。要不然我发帖是不敢点“我认为此问题必须由OpenList处理“的。
我尝试了alist 3.44,发现出现相同问题
大概率是openwrt默认使用dropbear的问题,并没有真正 SFTP 支持,哪怕你装了openssh-sftp-server也会造成很多不可控的权限问题。如果你确实需要,建议给openwrt换成openssh。
我同时跑着 alist 3.40.0,一样的配置,访问 /etc 是没有问题的。要不然我发帖是不敢点“我认为此问题必须由OpenList处理“的。
我尝试了alist 3.44,发现出现相同问题
我这边 alist 3.44 是正常的。。。
我试了把 openlist 退回到最近一次 sftp 驱动 commit 之前的 4.0.7 版,问题照旧。水平有限,没有头绪了。
sftp还有个小问题就是,似乎不能指定默认目录,登录都是根目录。
sftp还有个小问题就是,似乎不能指定默认目录,登录都是根目录。
请尝试在服务端 sshd_config 借鉴并修改如下内容:
Match User someuser
ChrootDirectory /var/sftp
有没有可能是因为 OpenWrt /etc 目录下有不存在的时区软链:TZ -> /tmp/TZ
不如挂载 SFTP 时打开一下 忽略软链接错误 ?
有没有可能是因为 OpenWrt /etc 目录下有不存在的时区软链:
TZ -> /tmp/TZ不如挂载 SFTP 时打开一下 忽略软链接错误 ?
确实是这个问题,果然是精通 OP 的高人。