pymumu / smartdns

A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验,支持DoH,DoT。
https://pymumu.github.io/smartdns/
GNU General Public License v3.0
7.92k stars 1.05k forks source link

文件权限被改变 #1755

Closed scruel closed 3 days ago

scruel commented 2 weeks ago

问题现象 配置增加 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 commented 2 weeks ago

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

scruel commented 2 weeks ago

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

pymumu commented 2 weeks ago

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

scruel commented 2 weeks ago

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

PikuZheng commented 2 weeks ago
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 commented 2 weeks ago
 - ./:/etc/smartdns

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

scruel commented 2 weeks ago

了解,晚点我来试试

scruel commented 3 days ago

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