Default file creation permissions

Gerard Seibert gerard at seibercom.net
Thu Sep 21 02:39:19 PDT 2006


Aitor San Juan wrote:

> I have a shell script whose execution is scheduled by CRON. The
> command scheduled is of the form:
> 
> 50 23 * * 1-5 /apps/batch/cronjobs/bd_backup.sh >
> /apps/batch/logs/bd_backup.log 2>&1
> 
> This shell script runs under the id of root. The file permissions of
> the log file created are 644 (owner: root, group: wheel). I'd like that
> the file permissions of the log created be 600 (or 640 maximum). How
> could I accomplish this? This is probably related to "umask", but I
> don't dare changing anything in case that change could affect some
> other security configuration as a side effect.
> 
> What would you recommend?

I have a few shell scripts that are run from CRON also. To accomplish
what you want, I have 'chmod' and 'chown' commands in the scripts.
Perhaps you might be able to incorporate something like that into yours.

-- 
Gerard

     "Health experts in Europe now say one carrot a day can keep you free of
     colon cancer. You know, I just hope they mean you eat it."


More information about the freebsd-questions mailing list