Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Been trying to run a cron but keep getting permission died error in my /var/spool/mail/root

"/bin/sh: /disk1/archives/ Permission denied"

This is my ls -hal for the directory my cron jobs are in

drwxr-xr-x 4 root root 4.0K Feb  6 04:22 .
drwxr-xr-x 6 root root 4.0K Feb  5 08:14 ..
-rwxr-xr-x 1 root root  105 Feb  6 04:22 backup
-rw-r--r-- 1 root root  102 Feb  5 08:34 backup.database.cron
-rw-r--r-- 1 root root   75 Feb  5 08:33
drwxr-xr-x 2 root root 4.0K Feb  5 08:35 databases

I have backup set to chmod +x

The backup file looks like this

* * * * *  root /disk1/archives/
30 * * * * root /disk1/archives/backup.database.cron

I ran the cron with

crontab /disk/1/archives/backup

I can see that my cron jobs are set up to run because when I do crontab -l I get

[root@web archives]# crontab -l
* * * * * /disk1/archives/
30 * * * * /disk1/archives/backup.database.cron looks like

tar -zcvf /disk1/archives/websites/`date +%Y-%m-%d_%I:%M:%S%p`.tar.gz /web

while looks like

mysqldump --opt --all-databases | gzip > /disk1/archives/databases/`date +%Y-%m-%d_%I:%M:%S%p`.sql.gz

am i missing a permission change somewhere?

am i running the correct scripts thru the crontab?

share|improve this question
is there /web ? and also please replace commands with full path since cron runs in limited PATH – kaji Feb 6 '12 at 10:47
up vote 2 down vote accepted
chmod +x /disk1/archives/backup.*.cron

The file that you feed to crontab command doesn't need to be executable, since it isn't a shell script. Any commands that you invoke as cron jobs do need to be executable.

There's another oddity here. There are two slightly different syntaxes for crontab. One has 5 fields that specify when the command is to be executed, followed by the command itself; this is the format that the crontab command expects. The other adds a username between the 5 time fields and the command. This is the format used by /etc/crontab, and by files under the /etc/cron.* directories. (That's on Ubuntu 11.04; the organization might differ slightly on other systems.)

You said you installed your backup file with crontab /disk/1/archives/backup, but the backup file you showed us specifies the root user on each line. But your crontab -l output doesn't show the root user name.

The error message you're getting is consistent with the crontab -l output (if the file you gave to crontab had the root username, it would attempt to execute root as a command). I presume the actual file you fed to crontab doesn't have the root fields.

man 5 crontab for information about the difference between normal and system cron files.

share|improve this answer
sorry for the late reply, your right. i got 2 clipboards confused when i pasted. The crontab doesn't have the root issued. So you are are saying that I need to chmod +x the backup.*.cron rather than the backup file that has the cron job rules. – s2xi Feb 6 '12 at 12:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.