chronyc
Monitor and control NTP client (chronyd)
TLDR
Start chronyc in interactive mode
Display tracking stats for the Chrony daemon
Print the time sources that Chrony is currently using
Display stats for sources currently used by chrony daemon as a time source
Step the system clock immediately, bypassing any slewing
Display verbose information about each NTP source
SYNOPSIS
chronyc [options] [command [arguments ...]]
chronyc [options] [hosts ...] command [arguments ...]
PARAMETERS
-h host
Specifies the host to connect to. Can be an IP address or hostname.
-p password
Provides the authentication password for remote control.
-n
Don't resolve host names for NTP sources when displaying information.
-m
Allows specifying multiple chronyd instances (hosts) on the command line in non-interactive mode.
-q
Suppresses informational messages, showing only command output or errors.
-t timeout
Sets the command timeout in seconds for communication with chronyd.
-i
Forces chronyc into interactive mode, even if commands are specified on the command line.
-d
Forces chronyc into non-interactive mode, even if no commands are specified on the command line.
-a addr
Binds chronyc to a specific local address when communicating with chronyd.
DESCRIPTION
chronyc is the command-line interface for chronyd, the NTP (Network Time Protocol) client and server. It allows users to monitor chronyd's performance, query its current state, and make runtime configuration changes. chronyc can be used to display information about NTP sources, check the synchronization status of the system clock, adjust NTP tracking parameters, and perform immediate clock adjustments. It communicates with the chronyd daemon, typically via a Unix domain socket for local connections or a network connection for remote control. chronyc supports both interactive and non-interactive modes, making it versatile for scripting and manual administration tasks. It is an essential tool for managing time synchronization on Linux systems using chrony.
CAVEATS
Local commands requiring configuration changes or system clock adjustments (e.g., makestep, burst) often require chronyc to be run as root or with appropriate permissions (e.g., membership in the chrony group, or the chronyd process configured to allow unprivileged local control).
Remote control requires chronyd to be explicitly configured to allow commands from the client's IP address (using the CMDSPEC directive in chrony.conf) and, for security, should utilize a shared secret for authentication via the -p option.
Misconfiguration of chrony.conf or incorrect use of chronyc commands can lead to incorrect system time, which can impact system stability and security.
INTERACTIVE VS. NON-INTERACTIVE MODE
chronyc can be run interactively by simply typing chronyc at the command line, which provides a prompt (chronyc>) for entering commands. In non-interactive mode, commands are passed directly as arguments, making it suitable for scripts (e.g., chronyc sources).
COMMONLY USED COMMANDS
Some frequently used chronyc commands include:
- sources: Displays information about the currently configured NTP sources.
- tracking: Shows detailed information about the system's time synchronization status.
- sourcestats: Provides statistics about each NTP source.
- makestep: Forces chronyd to immediately step the system clock to the correct time.
- burst count: Tells chronyd to perform a burst of NTP requests for faster initial synchronization.
- rtc: Displays or adjusts information about the Real Time Clock (RTC).
- activity: Shows the number of NTP servers currently online/offline.
AUTHENTICATION
For security, especially when controlling chronyd remotely, chronyc supports authentication using a shared secret. This secret is defined in chrony.conf and provided to chronyc via the -p option. Without proper authentication, remote commands may be rejected by chronyd.
HISTORY
The chrony project, including chronyc, was initiated by Richard P. C. Quirk with the goal of creating a robust and accurate implementation of the NTP protocol. It was designed to be more suitable than ntpd for systems that are frequently disconnected, have unreliable network access, or are virtual machines where timekeeping can be challenging. chronyc has been an integral part of this project, evolving alongside chronyd to provide comprehensive control and monitoring capabilities for the daemon's advanced features. Its development has focused on efficiency, accuracy, and providing immediate feedback on time synchronization status.
SEE ALSO
chronyd(8), chrony.conf(5), timedatectl(1), ntp(8), ntpdate(8)