how to sync time in kali linux

Time Synchronization on Kali Linux (GUI & Commands)

It’s important to keep the clock synchronized with a server at all time. And even if Kali Linux has this feature enabled by default, it’s not necessarily clear when you use the interface, and can quickly become complicated if you try to edit the configuration. In this article, I will answer all your questions about time configuration on this distribution.

By default, Kali Linux uses an Internet server to synchronize the time, and the time zone selected during the installation. These settings are not necessarily clear via the graphical user interface, but can be verified in command lines.

I will begin by detailing the default setup in Kali Linux, followed by instructions on adjusting the timezone and time synchronization through the interface. Lastly, for those requiring more control, I’ll explain how to utilize NTP and timedatectl to tailor time synchronization according to your needs.

Master Linux Commands
Your essential Linux handbook
Want to level up your Linux skills? Here is the perfect solution to become efficient on Linux. 20% off today!

Download now

How does time synchronization work on Kali Linux?

To check the current time configuration on Kali Linux, open the Settings Manager via the main menu and click on “Time and Date”.

You’ll get a window looking like this:

Hide your IP address and location with a free VPN:
Try it for free now, with advanced security features.
2900+ servers in 65 countries. It's free. Forever.

To change anything on this screen, you need to click on “Unlock” to get administrator privileges (if allowed).

I don’t know if I broke something on my system, or if it’s some kind of bug. But as you can see in my screenshot, the configuration is noted as “Manual”, and when I try to switch to auto, I get an error message:

“NTP support is not installed – Please install and activate NTP support in the system to enable synchronization of your local time server with Internet time servers.’

Well, it’s not true. Time synchronization is enabled by default, it’s just not using NTP anymore. So it looks like a bug to me. I’ll explain how to use the terminal to change the current configuration, don’t rely on the graphical interface if you get something similar.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!

Just know that time synchronization is enabled by default, even if it’s not mentioned in the settings. So you probably don’t have to change anything, unless you are experiencing some kind of issues. In this case, check the next part of the article to see how to configure it.

Also, remember that time synchronization requires Internet access. If there is a delay between your Kali Linux system and other computers, that might be the reason. Try to connect your system to the Internet, wait a few minutes, and the time should be adjusted automatically.

How to fix the time on Kali Linux?

Kali Linux date & time are automatically synchronized with a server on the Internet, but it’s possible to disable this or change the timezone in the system settings.

How to enable or disable automatic date and time?

As we have just seen, it’s not possible to change the time configuration via the graphical user interface in Kali Linux (at least in the current version), unless you install NTP.

But if the bug is not appearing on your system, you can simply:

  • Open the system settings.
  • Open “Date & Time”.
  • Click on “Unlock” to have access to the configuration.
  • In the “Configuration” list, select “Automatic” instead of “Manual”.
  • Click on “Close”, there is no save button, it’s directly saved.

And if, like for me, it’s not working, check the manual configuration in the next part of this article to configure it via the terminal.

How to change the time zone?

The first option in the “Time and Date Settings” window allows you to set a specific timezone, or configure it to change automatically based on your system location.

The “Automatic Time Zone” option in Kali Linux will use location services and your Internet IP address to determine the correct time zone to use. This is especially beneficial if you travel frequently. By enabling this feature, your system will consistently display the local time.

By default, Kali Linux uses the time zone you selected during the installation. Here’s how to switch to a different one:

  • Click on the current time zone (In my previous screenshot, it’s “US/Eastern”).
  • The same map you viewed during installation will appear. You can click on the map to set the timezone you want to use. It will also select the biggest city near your click, so try to click exactly where you are (not the timezone only).
  • Close the window to save your changes, the new timezone is immediately used on your system.

How to manually sync time on Kali Linux?

On the current Kali Linux version, the only way to change the synchronization options or the time server used is via the command line.

Let me introduce some useful commands and configuration files

Introducing timedatectl on Kali Linux

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!

Timedatectl is the primary tool you can use on Kali Linux to configure the date and time. It’s included by default in recent releases. Open a terminal and enter this command to view the current configuration:
timedatectl

Basically, we should see the same settings as via the graphical interface. But as you can see, it’s mentioned here that the system clock is synchronized and that the NTP service is active (I believe it wasn’t installed??).

Edit the configuration with timedatectl on Kali Linux

You can not only use timedatectl to view the current configuration, but also to make minor adjustments to it.

Here are the most important options you can try:

Become a Cyber Security Expert!:
Enroll in the Complete Cyber Security Course now, and master online safety.
Learn to defeat hackers, protect privacy, and stay anonymous with over 50 hours of on-demand video.
  • List the timezones available:
    timedatectl list-timezones
    timedatectl list-timezones | grep Europe
  • Change the current timezone:
    sudo timedatectl set-timezone <timezone-name>
    sudo timedatectl set-timezone America/New_York
    sudo timedatectl set-timezone Europe/Paris
  • Enable or disable time synchronization:
    sudo timedatectl set-ntp false
    sudo timedatectl set-ntp true
  • Set the current time manually (time synchronization must be disabled first):
    sudo timedatectl set-time 'Y:M:D HH:mm:ss'
    sudo timedatectl set-time 'Y:M:D'
    sudo timedatectl set-time 'HH:mm:ss'

These are the basic command options you need to know about timedatectl in Kali Linux. This is quite useful as the graphical interface doesn’t seem to work properly at the time of writing.

However, you can’t change the server used directly with these commands; you need to edit the configuration file.

Set a different time server on Kali Linux

The time synchronization system on Kali Linux uses timedatectl and systemd-timesync (instead of NTP). To use a different server, you must edit the configuration file, located at /etc/systemd/timesyncd.conf.

Here is how to do this:

  • Open a terminal, or connect via SSH.
  • Open the configuration file:
    sudo nano /etc/systemd/timesyncd.conf
    Enter your password if needed.
  • The file looks like this:
    Everything is commented by default, but you can see the default configuration.
  • To use a custom server, add a new line, starting with FallbackNTP and the server you want to use. It can be a local IP address, a host name or a domain name. You can also set several severs, by separating them with spaces.
    For example:
    FallbackNTP=0.us.pool.ntp.org 1.us.pool.ntp.org
  • Save and exit (CTRL+O, CTRL+X).

A reboot might be required to update the system configuration. The date & time will now be synchronized with your server, instead of the default one.

I hope this tutorial was useful, and answered all your question about time synchronization on Kali Linux.

TL;DR

  • Time synchronization is enabled by default on Kali Linux, you don’t have to worry about it for typical usage.
  • There is a bug in the interface currently, saying that time synchronization is disabled.
  • You can use the “timedatectl” command to see the real configuration, or do minor changes.
  • The only reason to edit the configuration file is to use a specific time server.

Whenever you’re ready for more security, here are things you should think about:

- Break free from Gmail: You should be able to choose what happens to your data. With Proton, only you can read your emails. Get private email.

- Protect yourself online: Use a high-speed Swiss VPN that safeguards your privacy. Open-source, no activity logs. Get Proton VPN risk-free.

- Master Linux commands: A sure method to learn (and remember) Linux commands. Useful ones only, one at a time, with clear explanations. Download the e-book.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *