problem with the cron tab.

Hi,

I have a cron tab file , which executes a particular script in a scheduled time and creates a output file. Since the cron tab file was created by the root , there is no access permission( for the output files) for other users irrespective of the default directory permission on which the output file is created.

Cheers,
balajiuthira

Just add an extra line at the end of the job to chmod "read for all" on the output file...

You could make use of the setgid bit and create a directory where you write just that log file into. Assign a group to that directory, where the users are in that should be allowed to read the output, set the permission bits with chmod on the directory accordingly and have the setgid bit being set too.

Example:

$> mkdir logs
$> ll| grep logs
drwxr-xr-x  2 root   root    4096 10. M�r 10:12 logs
$> chmod 644 logs
$> ll| grep logs
drw-r--r--  2 root   root    4096 10. M�r 10:12 logs
$> chmod g+s logs
$> ll| grep logs
drw-r-Sr--  2 root   root    4096 10. M�r 10:12 logs
$> chgrp somegrp logs
drw-r-Sr--  2 root   somegrp    4096 10. M�r 10:12 logs

In this case, the files created in that directory would be owned by root and the group "somegrp" with the according bit mask:

$> touch logs/bla
$> ll logs
total 8
drw-r-Sr--  2 root somegrp 4096 10. Mar 10:22 .
drwxr-xr-x 15 root somegrp 4096 10. Mar 10:21 ..
-rw-r--r--  1 root somegrp    0 10. Mar 10:22 bla

@vbe , thank you so much .. but adding a chmod line is not working fine . moreover if I am really not sure of the output file name created , how this method will be helpful.

@Zaxxon, things are not working fine , as you have mentioned. I did things as you mentioned, but again the files are created with priveleges for root only :wall:

balajiuthira

Are you sure you did exact every step as shown above?

Please put the result of this command :