[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cron & file permissions



Hi Chris,

On Thu, Jul 19, 2012 at 12:06:33PM +0100, Chris Davies wrote:
> Mike McClain <mike.junk@nethere.com> wrote:
> > /mc/bin/daily sets umask
> > umask 037                       #   save files rw owner, group read only
> 
> > then runs a script like so:
> > [ -e /mc/bin/secure ] && /mc/bin/secure 2>&1 | tee /root/sysstats/secure.log
> 
> You want the output to go to the cron email as well as to the log file?

Yes. 

> > but the permissions on secure.log come out 600:
> > root@/deb60:~> ls -l sysstats/secure.log
> > -rw------- 1 root root 67832 Jul 18 02:01 sysstats/secure.log
> 
> > What do I need to do to make secure.log permissions come out 640?
> 
> The permissions from umask are only applied to files that are created. If
> sysstats/secure.log already exists they won't be changed.

This was the clue I needed!
There was a call to 'savelog -p' before the /mc/bin/secure call and
that was creating an empty secure.log with the permissions of the previous.

Thanks for the help.
Mike
-- 
Satisfied user of Linux since 1997.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


Reply to: