Overview
Correct time and timezone settings keep logs consistent, make TLS and authentication
work, and prevent confusing cron schedules. Modern Linux uses systemd-timedated to
manage both the clock and NTP synchronisation. This article shows how.
Before you begin
- A Pod with sudo or root access.
Steps
1. Check the current time
bash
timedatectl
2. List and set the timezone
bash
timedatectl list-timezones | grep -i Europe
sudo timedatectl set-timezone Europe/Berlin
Use UTC on servers unless you have a strong reason not to — it avoids DST surprises.
3. Enable NTP synchronisation
bash
sudo timedatectl set-ntp true
timedatectl status
Look for System clock synchronized: yes and an NTP service: active line.
4. Verify the sync source
- Ubuntu/Debian typically use
systemd-timesyncd:
bash
timedatectl show-timesync --all
- RHEL family use
chrony:
bash
chronyc sources -v
chronyc tracking
5. Hardware clock
bash
sudo hwclock --systohc # write system time to the hardware clock
Windows
On a Windows Pod, use PowerShell:
powershell
Set-TimeZone -Id "UTC"
w32tm /resync
Troubleshooting
- Problem: clock is off by hours. Solution: the timezone is wrong — check with
timedatectland set it again. - Problem: NTP not syncing. Solution: confirm outbound UDP/123 is allowed and
the
systemd-timesyncd(orchronyd) service is running. - Problem: cron jobs fire at the wrong time. Solution: set a fixed timezone and schedule jobs in server time.
Related articles
- [Initial server hardening after installation]
- [Updating the operating system]
- [Managing users and sudo access]
