≡ Menu

cron Error: bad username; while reading /etc/cron.d file on Linux

I am getting the following error in my cron job log file /var/log/cron.log:
       Aug 22 01:59:01 server2 cron[7510]: Error: bad username; while reading /etc/cron.d/backups
I have job entry as follows to run a job at 00:50 every day for root user:
       50 0 * * * /etc/cron.d/backups
How do I fix this problem on Linux or Unix-like system?

You are getting this error because you forgot to set name of the user to run a cron job:


1 2 3 4 5 USERNAME /path/to/command arg1 arg2

    1: Minute (0-59)
    2: Hours (0-23)
    3: Day (0-31)
    4: Month (0-12 [12 == December])
    5: Day of the week(0-7 [7 or 0 == sunday])
    USERNAME - Name of the user
    /path/to/command – Script or command name to schedule

The correct syntax is as follows for root user to run a cron job at 00:50 every day:

50 0 * * * root /etc/cron.d/backups

To run as vivek user:

50 0 * * * vivek /etc/cron.d/backups

See our tutorial “HowTo: Add Jobs To cron Under Linux or UNIX?” for more information.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 0 comments… add one }

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: ,