Cron jobs and root password expiration

From MyWiki

Revision as of 10:57, 13 June 2013 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

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 commans, 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