ubuntu用bind9自建DNS服务器时logging日志出现failed: permission denied解决方法:
日志文件要放在/var/log/named/目录下,比如:/var/log/named/bind.log
/etc/bind/目录下创建named.conf.log文件,内容如下:
logging {channel bind_log {file "/var/log/named/bind.log" versions 3 size 10m;severity info;print-category yes;print-severity yes;print-time yes;};category queries { bind_log; };
};
/etc/bind/named.conf后面添加:
include "/etc/bind/named.conf.log";
修改文件用户:
chown bind:bind /var/log/named/bind.log
原因是/etc/apparmor.d/usr.sbin.named这个文件中有:
/var/log/named/** rw,
/var/log/named/ rw,
你也可以修改成你指定的目录。