[nsd-users] logging error on /etc/nsd/nsd.log

Simon Deziel simon at sdeziel.info
Sat Jun 18 17:36:02 UTC 2022


Hi Mukul,

On 2022-06-18 11:21, Mukul Shukla via nsd-users wrote:
> Dear All,
> 
> I have recently shifted my Authoritative DNS server from very old TinyDNS
> to NSD. Presently it is in a very primitive stage, but  working  absolutely
> fine.
> 
> I have installed NSD on Debian Testing because I could find a relatively
> newer version of NSD on Debian Testing. I am running the NSD version 4.5.0.
> I am enabling the NSD logging  to /var/log/nsd.log. When I check the status
> of the NSD demon by "systemctl status nsd", I get the following error
> message.
> 
> Jun 18 20:39:02 ns1 systemd[1]: Starting Name Server Daemon...
> Jun 18 20:39:02 ns1 nsd[1884]: [2022-06-18 20:39:02.460] nsd[1884]: error:
> Cannot open /var/log/nsd.log for appending (Permission denied), logging to
> stderr
> Jun 18 20:39:02 ns1 nsd[1884]: [2022-06-18 20:39:02.460] nsd[1884]:
> warning: chown /var/log/nsd.log failed: Read-only file system

The systemd unit shipped by Debian assumes default logging to syslog. As 
such, the systemd unit needs to be edit if you want file logging:

   sudo systemctl edit nsd # will open $EDITOR

Then put the following and save:

   # Allow file logging to dedicated dir
   ReadWritePaths=/var/log/nsd

And create the directory and restart NSD:

   sudo mkdir /var/log/nsd
   sudo chown nsd: /var/log/nsd
   sudo systemctl restart nsd


The above has NSD log to a subdirectory as it is safer than granting 
write access to all /var/log.

HTH,
Simon


More information about the nsd-users mailing list