[Dnsmasq-discuss] Permission denied on logfile

Simon Kelley simon at thekelleys.org.uk
Tue Sep 21 20:40:17 UTC 2021



On 21/09/2021 20:54, Johannes Stezenbach wrote:
> Hi,
> 
> a minor issue I noticed while debugging:
> 
> I added this to the dnsmasq command line:
>   --log-queries=extra --log-debug --log-facility=/tmp/dnsmasq.log
> (actually set in DNSMASQ_OPTS in /etc/default/dnsmasq in Debian)
> 
> This works the first time, but fails after dnsmasq is restarted:
>   dnsmasq: cannot open log /tmp/dnsmasq.log: Permission denied
> 
> $ ls -l /tmp/dnsmasq.log
> -rw-r----- 1 dnsmasq root 515 Sep 20 21:50 /tmp/dnsmasq.log
> 
> 

I think this is because the /tmp/directory has the sticky bit set. The
file is owned by user dnsmasq, but it's opened whilst dnsmasq is still
running as root, and that may fail in a stick-bit directory. What
happens if you put the log file somewhere else?


Simon.



More information about the Dnsmasq-discuss mailing list