We help IT Professionals succeed at work.

Linux:  Pull NTP Configuration

itsmevic asked
Where is NTP configuration held on a Linux server?  For example, you can can find NTP info from Windows in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters.  Any help with this is greatly appreciated!
Watch Question

Dr. KlahnPrincipal Software Engineer

1) Are you referring to an NTP client or an NTP server?

2) What version of linux?



I'm referring to an individual Linux instance that is configured to pull time down from an NTP source.  For example, Windows machines that are configured for NTP reflect this in their registry settings.  Where on Linux would one need to go to see if that Linux box is configured with NTP?

Principal Software Engineer
Depends on whether that system is using the NTP daemon, or ntpdate.

The NTP daemon, ntpd, runs at startup and has a config file somewhere.  Where it is located depends on the distribution.  Many distributions carve up the standard utilities and put their init files in nonstandard locations.

For systems that have relatively good clocks, running ntpdate out of crontab a few times a day is sufficient.  In this case no config file is necessary.

Look in /etc/crontab and if there is no reference to ntpdate there, look in ... well, on a SysVinit machine, look in /etc/init.d for references to ntpd.  On a system that uses systemd it could be anywhere under /etc.

If all else fails, grep is your friend.  sudo grep -r -i -l ntp /etc/*
nociSoftware Engineer
Distinguished Expert 2019

/etc/ntp.conf  is the most common used config file. If it is different  ps ax | grep ntp from root show show the command line.

This are a bit different on systemd machines there it depends on the version of the systemd if it still uses an external ntpd config (/etc/ntp.conf) or some internal stuff.

ntpq -p should give the servers/peers used .

ntpq can also be used to query & config the ntpd daemon. 

check the doc on ntpq using man ntpq



Thanks, all!