We help IT Professionals succeed at work.

Linux:  Pull NTP Configuration

itsmevic
itsmevic asked
on
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!
Comment
Watch Question

Dr. KlahnPrincipal Software Engineer
CERTIFIED EXPERT

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

2) What version of linux?

Author

Commented:

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
CERTIFIED EXPERT
Commented:
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
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:

/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

Author

Commented:

Thanks, all!