Results 1 to 5 of 5

Thread: cron job "authentication failure"

  1. #1
    Join Date
    Sep 2008
    Beans
    341

    cron job "authentication failure"

    I'm having some problems getting cron jobs to run.

    If I want to get a cron job to run under my own user account, using crontab -e, then that works just fine.

    However, if I want to get a cron job to run as root, then it doesn't want to play. If I either put a script into the /etc/cron.daily or /etc/cron.hourly folders, or set up the job using sudo crontab -e, then the job doesn't run. I've tested this with a really simple script that just writes "hello world" to a log file, and which runs perfectly OK from a terminal.

    If I check the syslog at the time the cron job should have run, I see output like this:

    Code:
    Jun 25 14:17:02 localhost CRON[29395]: Authentication failure
    Any ideas what could be going on? I'm using Ubuntu server 12.04, and I'm also wondering if it might be related to another problem I've been having, which is described in this thread.

    Thanks

    NM

  2. #2
    Join Date
    Mar 2013
    Beans
    27

    Re: cron job "authentication failure"

    Show the script, please.

  3. #3
    Join Date
    Sep 2008
    Beans
    341

    Re: cron job "authentication failure"

    Quote Originally Posted by Vitsliputsli View Post
    Show the script, please.
    Sure, no problem. Here it is:

    Code:
    #!/bin/sh          
    DET="Plain shell script"
    
    LOGPATH="/var/log/"
    
    DATETIME=$(date +%Y-%m-%dT%H:%M:%S)
    LOGNAME="backup-test.log"
    
    LOGFILE="$LOGPATH$LOGNAME"
    
    echo "$DET run at $DATETIME" >> $LOGFILE
    As I say, it runs just fine if I run it manually from a terminal.

  4. #4
    Join Date
    Mar 2013
    Beans
    27

    Re: cron job "authentication failure"

    Very strange. Have you another problems with root account? Can you login by root in terminal? Are you set up password for root?

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,006
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: cron job "authentication failure"

    Does the cron entry happen to have sudo in it? Files like /etc/cron* or /var/spool/cron/root run with root privileges by default. They do not need a sudo entry.

    The cron entry should just be

    Code:
    1 1 * * * /path/to/some/script
    to run "script" every day at 1:01 am.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •