I've commented out a line in the crontab on a debian server, which I guess was there by default yet was causing me to get error emails every hour:

# m h dom mon dow user  command
17 *   * * *   root    cd / && run-parts --report /etc/cron.hourly

However, the error emails keep coming in as if it hasn't been commented out. The error emails:

Subject: Cron <root@(none)> root    cd / && run-parts --report /etc/cron.hourly (failed)
/bin/sh: root: not found

Any ideas?

  • wouldn't be easier to sudo vi crontab, that way you are modifying root's crontab? – Patrick Feb 19 '11 at 14:16
  • @patrick: I'm logging in as root, so there's no sudo.. – GJ. Feb 19 '11 at 18:24
  • Just in case it helps anyone else, I received this error because I ran crontab -e /etc/crontab, which DOES NOT safely edit /etc/crontab. It creates a duplicate that generates this error, and can be removed by running crontab -r. – Jacob Hume Feb 4 '16 at 18:43
up vote 5 down vote accepted

When you say "the crontab" you're not being specific. You should say which one you mean. However, based on the contents, it looks like /etc/crontab. Since that file does have a user field, it doesn't make sense that you'd get that error. My bet is that there's a user crontab that has that line in it. User crontabs don't contain user fields.

The proper thing to do is not to change that line in /etc/crontab. There may be other jobs it runs.

You can edit that file and the files in the /etc/cron.* subdirectories using any editor. You can specify the editor you want to use when you use crontab -e by setting the EDITOR environment variable.

You should use crontab -e to edit user crontabs (including root's). Remove the user field or remove that line in the user crontab where it appears (not /etc/crontab). User crontabs don't have a user field, but the system crontabs do.

User crontabs are located in /var/spool/cron/crontabs. You can sudo grep for the line to find out which file has the stray line. Again, only use crontab -u username -e to edit the user crontab.

Check the manpage on your system for crontab(5) (man 5 crontab), especially under the "EXAMPLE SYSTEM CRON FILE" section. Only the /etc/crontab file includes a username field. Non-system user crontabs do not include this field. If you want to edit /etc/crontab, then use a text editor, not the crontab(1) command.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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