How to use NTP to synchronize Linux system time

  
                

When we use a computer, we sometimes find that the system time is out of order. So how do you make the system time accurate? Today Xiaobian teaches you a simple way to use NTP for system time adjustment.

NTP is short for Network Time Protocol, meaning "Network Time Protocol" is a time synchronization protocol implemented by TCP/IP.

Ubuntu automatically synchronizes to ntp.ubuntu.com every time it starts. However, since the server generally does not start frequently, the time offset cannot be avoided, and the deviation may be large. Therefore, we need to correct the time of the server from time to time. The most convenient way is to perform a time synchronization every day with cron's scheduled tasks.

Solution:

1. Create a file /etc/cron.daily/timeupdate:

___ FCKpd ___ 0nbsp; sudo nano /etc/cron.daily/timeupdate

2. Enter the following:

ntpdate ntp.ubuntu.com

3. After saving the file, you also need to give it executable permissions:

___FCKpd___2nbsp;sudo chmod 755 /etc/cron.daily/timeupdate

This way, the system can get time every day at ntp.ubuntu.com (all tasks in /etc/cron.daily/directory will be executed every day) Once) and calibrate the time of the server itself. If you are concerned about time acquisition failure, you can add multiple NTP servers to the /etc/cron.daily/timeupdate file:

ntpdate ntp.ubuntu.com pool.ntp.org

The above is the way to solve the Linux system time error. If you find that your computer system time is also wrong, then use this method to solve it.

Copyright © Windows knowledge All Rights Reserved