Home Blog CV Projects Patterns Notes Book Colophon Search

Cron Update

24 Apr, 2021

Once this is set up I like to set a Cron job to keep OpenSSH up to date and secure:

I add this line to sudo crontab -l to upgrade key packages every night at midnight:

0 0 * * *  apt update && apt upgrade -y openssh-server && date > /root/last-updated

I can then always check the /root/last-updated file to see when the update was last run (and therefore that everything is running correctly).

I also tend to have ufw, fail2ban and some Apache packages I'd like to keep up to date too so I modify the cron job like this:

0 0 * * *  apt update && apt upgrade -y openssh-server ufw fail2ban apache2-data apache2-bin apache2 apache2-utils && date > /root/last-updated

TIP: If everyone updated everything at midnight each day, the servers that provide the updates would be hit with a lot of traffic all at once. Perhaps change your copy of the cron job to run at a different time.

Comments

Be the first to comment.

Add Comment





Copyright James Gardner 1996-2020 All Rights Reserved. Admin.