Skip to main content

Why This Matters

Many security protocols leverage accurate time. If your system time is incorrect, it could have negative impacts on:
  • Authentication mechanisms
  • Log correlation
  • Certificate validation
  • Scheduled security updates
An NTP client keeps your system time in-sync with global NTP servers.

How It Works

NTP stands for Network Time Protocol. An NTP client on your server updates the server time with the official time pulled from public NTP servers at https://www.pool.ntp.org/en/
Starting with Debian 13 (Trixie), the classic ntp package has been removed. Running sudo apt install ntp will fail with “Package ntp has no installation candidate”.Since this guide only uses NTP as a client (to sync the server’s clock), the recommended approach on Debian 13+ is to use systemd-timesyncd, which is already pre-installed.

Configuration

systemd-timesyncd is a lightweight SNTP client already included in Debian. Unlike the full ntpd daemon, it does not listen on any port, making it a smaller attack surface.
1

Enable NTP synchronization

sudo timedatectl set-ntp true
2

Verify it's working

timedatectl status
You should see:
  • NTP service: active
  • System clock synchronized: yes
3

Configure NTP servers

Backup the configuration file:
sudo cp --archive /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf-COPY-$(date +"%Y%m%d%H%M%S")
Edit /etc/systemd/timesyncd.conf and set the [Time] section:
[Time]
NTP=pool.ntp.org
FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org
Or use this command:
sudo sed -i -r -e "s/^#?NTP=.*$/NTP=pool.ntp.org/" /etc/systemd/timesyncd.conf
sudo sed -i -r -e "s/^#?FallbackNTP=.*$/FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org/" /etc/systemd/timesyncd.conf
4

Restart the service

sudo systemctl restart systemd-timesyncd
5

Check synchronization status

timedatectl timesync-status
You should see output similar to:
       Server: 108.61.56.35 (pool.ntp.org)
Poll interval: 32s (min: 32s; max: 34min 8s)
         Leap: normal
      Version: 4
      Stratum: 2
    Reference: C342F10A
    Precision: 1us (2^0)
 Root distance: 24.054ms (max: 5s)
       Offset: +2.156ms
        Delay: 48.567ms
       Jitter: 1.452ms
 Packet count: 3

What This Does

With NTP configured:
  • Your system clock stays accurate
  • Security protocols that depend on time work correctly
  • Logs have accurate timestamps for forensics
  • Certificates are validated with correct time
  • Scheduled tasks run at the right times

Build docs developers (and LLMs) love