how to sync the date and time from another host without ntp

with the proliferation of firewalls by ISP’s with clueless system administrators, it is now all too common to find port 123 UDP/IP port blocked. since ssh is usually passed, it is possible to set the clock from another host to within a few seconds. on a fast connection, to within a second. this method requires:

  • ssh access to a host running the ntp service.

  • root access on the host that needs its clock set. either log in as root, or use sudo, as you prefer.

in this example, the host running the ntp service is

date ; date `ssh date +%m%d%H%M%Y.%S`; date

this should produce output similar to the following:

Sun Mar 20 22:10:08 PDT 2011
Sun Mar 20 22:26:08 PDT 2011
Sun Mar 20 22:26:08 PDT 2011