I'm working on a production server. It has some daily cron jobs, and here's the filesystem permissions on them:
cron.daily$ ls -Al
total 24
-rwxr-xr-x 1 root root 332 Dec 3 10:33 0yum-daily.cron
-rwxr-xr-x 1 root root 2239 Jun 9 2014 certwatch
-rwxr-x--- 1 root root 953 Aug 29 2015 gdrive-backup
-rwx------ 1 root root 180 Jul 31 2013 logrotate
-rw-r--r-- 1 root root 618 Mar 17 2014 man-db.cron
-rw-r----- 1 root root 192 Jan 26 2014 mlocate
All but one of the jobs is from CentOS or the hosting provider; while one job is ours. The permissions spread the spectrum.
Our job is gdrive-backup, and its got hard coded usernames and passwords. We did not feel it appropriate to give the world read access to it.
What are the permissions supposed to be on a cron job when it sits on the filesystem?
Here is the cat of crontab, which (I think) shows there's nothing special going on:
$ cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
$
A related question is What are the runtime permissions of a cron job?, but it discusses the user credentials the job runs under, and not the filesystem permissions.
ls
output in your question is for root user, the jobs0yum-daily.cron
,certwatch
,gdrive-backup
andlogrotate
can run via cron or from the command line interactively. – MelBurslan Mar 29 '16 at 13:39ls
is from my user account. Its mostly unprivileged, but withsudo
access. I also visited CentOS's manual, and it clearly stated cron was the recurring job manager. There's no other recurring schedulers discussed. – Mar 29 '16 at 13:46root
. Unless of course you are touching any NFS file systems, where the access rights are managed by the server, not by your local machine only. Google Drive might be a potential problem, depending on your setup. – MelBurslan Mar 29 '16 at 13:53