umask for cron
Kevin Brown
kevin_brown@qwest.net
Tue, 20 Mar 2001 17:09:56 -0700
I did a search on google and found this:
In your cron entry just add 'umask NNN' before your script executes:
* * * * * umask '777'; backup_script_here
Give that a try and see if it works for you.
> This is a pure GUESS. Unless the cron binary itself
> sets the umask ("Use the source, Luke!") before running
> an entry in a crontab, my suspicion would be that the
> umask would be whatever the umask is when cron is started
> in the startup scripts. If it is in the cron binary,
> I would hope that it's not hardcoded, but rather there's
> a cron config file lying around in /etc somewhere that
> could set things like PATH and umask and whatnot.
>
> For giggles, you could try setting umask in the
> /etc/init.d/cron before the cron binary is executed.
> > Where does cron get its umas settings from?
> >
> > it doesn't seem to get it from
> > /etc/profile
> > /etc/bashrc
> > /etc/bash_profile
> > /etc/<any other regular login scripts i have searched through>
> > ~/.profile
> > ~/.bashrc
> > ~/.bash_profile
> > ~/.<any other regular login scripts i have searched through>
> >
> > is there a default system umask set anywhere for what permissions
> > files will be created with? or is it only done in the source code of the
> > program? and is there any way to overide it in cron other than running
> > programs within a shell script and changing the umask within the script?
> >
> > useing the script method would mean doing it for each and every cron job
> > ~1000 for one of our servers.