How to automatically sync date and time on *nix server

Here's how we do it on RHEL:

Logged in as root:

* Create file at /etc/cron.hourly/clockset
* with these two lines only:

rdate -s > /dev/null
hwclock --systohc > /dev/null

* chmod 700 /etc/cron.hourly/clockset

make a crontab entry:
0 6 * * * /etc/cron.hourly/clockset

open firewall ports:
rdate is for port 37.
NTP is for port 123.


source of time servers:

Tags: Server how-to