header image
Home arrow Blog arrow Tips arrow Repair cron after enable/disable root password in Ubuntu Hardy
Repair cron after enable/disable root password in Ubuntu Hardy PDF Print E-mail
Written by Han   
Sep 30, 2008 at 04:20 PM

For some time I have been using the cron package on my Ubuntu Hardy
machine to scheduling jobs that need to be excuted hourly. I found it
is very handy because all I need to do is to put the excutable scripts
into /etc/cron.hourly directory (Just to make sure their is no "." in
the file name, e.g. the script named "myscript-sh" will be excuted
while "myscript.sh" won't
). However, recently I found those scripts
that requires root privilege are no longer automatically excuted hourly

 

I spent some time today, and found the following error messages in the
/var/log/auth.log file:

 CRON[9103]: pam_unix(cron:account): account root has expired (account expired)

This reminds me that recently I have enabled the root passwd by
running the command

sudo passwd root

and then later I disabled the root passwd by running

sudo passwd -l root

A Google search leads to the following bug report, it turns out that
the second command above would set the root account to be expired
which causes those scripts in /etc/cron.hourly that needs root
privilege fail to execute.

The following work around posted in the bug report would solve the
problem:

 sudo passwd --unlock root
 sudo usermod --lock root


After running these two commands in terminal, the scripts in
/etc/cron.hourly would be executed hourly as normal.

 


User Comments

Comment by arno[dot]fleming[appleRoll]tis on 2008-12-27 06:36:05
I was experiencing the same! 
After STFW for an hour I found your useful post! Essentially the root account got locked for the whole system. Now it's not locked, it's only impossible to log in as root... 
I think I wouldn't figure out in a _long_ time! Thanks for the shortcut 
 
Arno
Your Name / Email Address
Security Check. Please enter this code Listen to code