permissions on /var/log/messages

Denys Vlasenko vda.linux at googlemail.com
Tue Mar 3 12:09:44 UTC 2009


On Tuesday 03 March 2009 02:14:47 am Hamish Moffatt wrote:
> On Mon, Mar 02, 2009 at 03:25:19PM +0100, Denys Vlasenko wrote:
> > On Monday 02 March 2009 07:03:53 am Hamish Moffatt wrote:
> > > I'd like /var/log/messages to be readable by non-root users. syslogd.c
> > > uses device_open to open the file though and it has the permissions
> > > hardcoded to 0600.
> > > 
> > > I can't really see why it uses device_open... nor a good solution.
> > 
> > I propose this patch.
> 
> >   reopen:
> > -		G.logFD = device_open(G.logFilePath, O_WRONLY | O_CREAT
> > -					| O_NOCTTY | O_APPEND | O_NONBLOCK);
> > +		G.logFD = open(G.logFilePath, O_WRONLY | O_CREAT
> > +					| O_NOCTTY | O_APPEND | O_NONBLOCK,
> > +					0666);
> 
> 0666 is too generous I think - but it works ok. 0644 or 0664 would be
> better.

You need to set umask as you see fit before you start sysklogd
(or any other file-creating process for that matter).
--
vda


More information about the busybox mailing list