Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件权限被改变 #1755

Closed
scruel opened this issue Jun 16, 2024 · 8 comments
Closed

文件权限被改变 #1755

scruel opened this issue Jun 16, 2024 · 8 comments

Comments

@scruel
Copy link

scruel commented Jun 16, 2024

问题现象
配置增加 conf-filecache-file 的配置后,
./conf/app.ini 文件的权限总被改为 root
./ 文件夹目录的权限和所有者也老是变
建议能读写就不要改 owner:group 了

bind [::]:53

cache-persist no
server 114.114.114.114
conf-file /etc/smartdns/smartdns.cache.conf

运行环境

version: '3'

services:
  smartdns:
    container_name: smartdns
    image: pymumu/smartdns:latest
    restart: always
    network_mode: host
    volumes:
      - ./:/etc/smartdns
@pymumu
Copy link
Owner

pymumu commented Jun 18, 2024

是不是你的日志文件也设置输出到/etc/smartdns了?

@scruel
Copy link
Author

scruel commented Jun 18, 2024

没有,配置就是上面那些,我是单独测试的

@pymumu
Copy link
Owner

pymumu commented Jun 18, 2024

smartdns除了会修改日志目录, cache目录的权限和属组,不会修改其他任何目录文件的权限,
排查下其他软件看看吧。

@scruel
Copy link
Author

scruel commented Jun 18, 2024

没有其他软件的,这是服务器上跑的,上述配置是就是可复现的配置,可以确定是 smartdns 所为。
按您的回复,配置 cache-file /etc/smartdns/cache 则会修改挂载的 ./ 的权限,倒可算是预期行为了,conf-file 晚些时候我再二次测试确认,不过是否有可能能禁用掉这个权限修改的逻辑?

@PikuZheng
Copy link
Contributor

localhost:~# mkdir /userdata/smartdns/conf
localhost:~# touch /userdata/smartdns/conf/app.ini
localhost:~# chown -R 999:users /userdata/smartdns/conf
localhost:~# ls -l /userdata/smartdns/conf/
total 0
-rw-r--r--    1 999      users            0 Jun 18 10:56 app.ini
localhost:~# docker restart smartdns
smartdns
localhost:~# ls -l /userdata/smartdns/conf/
total 0
-rw-r--r--    1 999      users            0 Jun 18 10:56 app.ini

在我这里不能复现。顺便说一下我用docker但不用compose

@PikuZheng
Copy link
Contributor

 - ./:/etc/smartdns

隔壁群里有人说挂载点使用相对路径就会有owner被改变的情况,改成绝对路径就好了。我没试,仅供参考

@scruel
Copy link
Author

scruel commented Jun 18, 2024

了解,晚点我来试试

@scruel
Copy link
Author

scruel commented Jun 29, 2024

测试 conf-file 不会修改权限,cache-file 则按预期修改了权限,将 cache 改为子目录后无问题。
建议增加一下文档,让用户注意创建一个新文件夹来放置 cache file,而不是将其放在任意地方,从而导致奇怪的权限修改问题。

@scruel scruel closed this as completed Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants