Operating System - Tru64 Unix
1748166 Members
3672 Online
108758 Solutions
New Discussion юеВ

Files permission generated by crontab jobs

 
Jess_13
Advisor

Files permission generated by crontab jobs

Hi all,
I wrote a script and put into crontab to run according to the schedule. The script generated output files with permission rw-r-r--, is there any way to change permanently the default permission to rw-rw-r--?

Thanks in advance!
6 REPLIES 6
Vladimir Fabecic
Honored Contributor

Re: Files permission generated by crontab jobs

Idea 1:
put chmod at the end of script
Idea 2:
change umask (not recomended)
Do this crontab jobs belong to root?
In vino veritas, in VMS cluster
Jess_13
Advisor

Re: Files permission generated by crontab jobs

Ya, I understand option 1, this is our workaround solution.

2nd method, I'd already change umask under that particular user profile. The output file generated using crontab is still by default rw-r--r--. This is only a normal user, having diff groups form other users.
Vladimir Fabecic
Honored Contributor

Re: Files permission generated by crontab jobs

Then change default umask in /etc/profile. This will work if not using advanced security.
In vino veritas, in VMS cluster
Orjan Petersson
Frequent Advisor

Re: Files permission generated by crontab jobs

cron does not read the users .profile.
You have to specify the command to be run by cron to be something like

su - username -c /path/to/some_command

if you want that to happen
Ivan Ferreira
Honored Contributor

Re: Files permission generated by crontab jobs

You can also set the umask at the very first line of the script executed by cron.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Jess_13
Advisor

Re: Files permission generated by crontab jobs

Thanks a lot for your suggestions and opinions.