How To Update Linux Server Time Behind a Proxy

These days I noticed that the time of one of my rarely used virtual Linux boxed was completely out of sync.

$ sudo apt-get -y install ntpdate
$ sudo ntpdate time.nist.gov
15 Jan 00:47:15 ntpdate[1805]: no server suitable for synchronization found

This failed because of a proxy blocking NTP.

With a little googling "NTP over HTTP" I finally found a solution to resync the clock:

$ sudo date -s "$(wget --no-cache -S -O /dev/null google.com 2>&1 | \
sed -n -e '/  *Date: */ {' -e s///p -e q -e '}')"
Show Comments