Cron jobs and root password expiration

From MyWiki

(Difference between revisions)
Jump to: navigation, search
(added error message to the article.)
(spelling corrected)
Line 13: Line 13:
</pre>
</pre>
-
Ubuntu seems to be different and doesn't have --stdin option for passwd commans, so I had to go around it after asking almighty search engine for help.
+
Ubuntu seems to be different and doesn't have --stdin option for passwd command, so I had to go around it after asking almighty search engine for help.
I don't care what's the password, because I use my personal account with sudo elevation to root ;-)
I don't care what's the password, because I use my personal account with sudo elevation to root ;-)

Revision as of 11:00, 13 June 2013

Recently stepped onto the good old time bomb. When you set password expiration on accounts and never use root, cron jobs scheduled for root will stop working when root's password expires. When it happens, you may see something like this in the logs:

CRON[25674]: Authentication token is no longer valid; new one required

To fix that on Ubuntu I setup pwgen and added this cron job for root:

# changing root password to prevent cron freeze
0 0 1 * * PASS=`/usr/bin/pwgen -s -y 15 1`; echo -e "$PASS\n$PASS" | (passwd root)

Ubuntu seems to be different and doesn't have --stdin option for passwd command, so I had to go around it after asking almighty search engine for help.

I don't care what's the password, because I use my personal account with sudo elevation to root ;-)

Personal tools