Synchronizing time with rdate on Debian Etch

Synchronizing time with rdate on Debian Etch


Summary

It is really important for security and logging to keep your computer's clock in sync with reality.

The preferred way to do this is ntp, but ntp wants to have a daemon running, and wants to load inetd, which is not something I want to do on stripped down productions servers. Fortunately, rdate has no dependencies and doesn't need to run a daemon.

These are my instructions for getting rdate to work on Debian 4.0 (Etch).


Detail

Well, you need to find a valid rdate server. For me, the easiest thing is to use another local machine running ntp (so the time is accurate). To enable the time service, edit /etc/xinet.d/time and change disable = yes to disable = no.

Then create the script /etc/cron.daily/timesync.sh:

/usr/sbin/rdate -s ntpserver.example.com

Do not forget to make it executable: chmod +x /etc/cron.hourly/timesync.sh