The Network Time Protocol daemon (ntpd) program is a Linux operating system daemon. It sets and maintains the system time of day in synchronism with time servers (Mills).

You need to configure ntpd via /etc/ntp.conf configuration file. The file is well documented and you easily configure it.

Install ntpd

If ntpd is not installed use any one of the following command to install ntpd:
# yum install ntpOR# up2date ntp


You should at least set following parameter in /etc/ntp.conf config file:
server <Time Server Name or IP Address>

For example, open /etc/ntp.conf file using vi text editor:
# vi /etc/ntp.conf
Locate server parameter and set it as follows:

Save the file and restart the ntpd service:
# /etc/init.d/ntpd start

You can synchronize the system clock to an NTP server immediately with following command:
# ntpdate

 5 May 14:36:01 ntpdate[5257]: adjust time server offset -0.343242 sec

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 20 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
20 comments… add one
  • cool mind Jul 13, 2006 @ 4:58

    Time is not updated through Any other server that can be configured in /etc/ntpd.conf. Please suggest

  • 🐧 nixCraft Jul 13, 2006 @ 6:20

    Goto -> and select the server you want 🙂

  • yellanna Oct 11, 2007 @ 11:24

    Iam unable to syn two systems time between redhat 7 and redhat enterprise 4.
    Is there any please reply.

  • Timothy Mar 17, 2009 @ 3:42

    Works perfect! GNOME wouldn’t update the time itself, so I came here. Thanks, buddy!

  • ksk May 27, 2009 @ 8:04

    its good but tell me how i sync the client with my ntp server

  • Gururaj Apr 21, 2010 @ 2:44

    Hi ,
    I am getting message as NTP socket in use , exiting … I am getting this message after I started the ntp service .

    Do you know what it is ? any solution ?


  • DrCyb May 3, 2010 @ 1:14

    I had the same problem with Gururaj, until I found out that I need to stop the NTP service first.
    /etc/init.d/ntpd stop
    Then only ntpdate will work.

    Why is this so when the instruction says to “Save the file and restart the ntpd service” then
    “You can synchronize the system clock to an NTP server immediately with following command:” ?

    The instructions doesn’t work in that order.

  • Sujith Jun 22, 2010 @ 12:52

  • Ville Jul 23, 2011 @ 16:01

    Use or
    They work nicely 🙂

  • Deb Mar 10, 2012 @ 3:19

    Hi, wanted to sync up my (SentOS)VM with NTP. Followed the above mentioned steps, but did not get the intended (described) results. Instead , I got the following errors :
    [root@vm-perfads02 America]# /etc/init.d/ntpd start
    Starting ntpd: <–Good ! No error !!
    [root@vm-02 ~]# ntpdate
    9 Mar 10:16:09 ntpdate[7372]: the NTP socket is in use, exiting
    [root@vm-02 ~]# ntpdate
    9 Mar 10:16:17 ntpdate[7375]: the NTP socket is in use, exiting
    [root@vm-02 ~]# rdate -s
    rdate: couldn't connect to host No route to host
    I ended up fixing the issue , by date command ( as below ):
    [root@vm-perfads02 America]# date
    Fri Mar 9 10:27:33 PST 2012 <–This date was incorrect
    [root@vm-perfads02 etc]# date 030918402012
    Fri Mar 9 18:40:00 PST 2012 <–This is correct date [same as other servers]
    Also bounced the box to recheck if the above date sticks and it does ! Hence sharing this info and good news. Kindest regards,

  • CharlieBrown Apr 16, 2012 @ 9:04

    ntpdate is not used anymore, now we have ntpd -q -g, as explained here:

  • Sameed Ahmed Oct 29, 2012 @ 8:38

    use ” ntpdate -u ”
    If your server is behind firewall.

  • Mark Jan 8, 2013 @ 4:10

    I’m facing the problem on time incorrect even I had sync it correctly with ntpd. Weird.

  • Shweta Jan 25, 2013 @ 7:20

    ntpdate ntp_server_ip
    after executing this command
    its showing like ” no server suitable for synchronization”
    Whats the reason behind this?

  • Santosh Mar 11, 2013 @ 22:32

    Comment by Sameed Worked for me.. here is my system output.

    [root@server1~]# ntpdate
    11 Mar 17:11:11 ntpdate[31328]: the NTP socket is in use, exiting

    [root@server1~]# date
    Mon Mar 11 17:11:17 CDT 2013

    [root@server1~]# ntpdate -u
    11 Mar 17:29:29 ntpdate[31551]: step time server offset 979.012426 sec

    [root@server1~]# date
    Mon Mar 11 17:29:35 CDT 2013

    • Santosh Mar 11, 2013 @ 22:34

      not sure.. why my command was truncated in my comments so re posting.. I used:

      “ntpdate [our internal server ip]” – Failed

      “ntpdate -u [our internal server ip]” – worked.

  • wintel2006 Jun 24, 2013 @ 17:58

    sntp -P no -r

    DO NOT use ntpdate anymore:

    !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!

    The ntpdate program is deprecated and should not be used any more.

  • DG Jul 24, 2013 @ 5:50

    I am using SLES 11.1

    !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!

    The ntpdate program is deprecated and should not be used any more. To
    quote the upstream ntp developers:

    “The functionality ntpdate offered is now provided by the ntpd daemon
    itself. If you call ntpd with the command line option -q it will
    retrieve the current time and set it accordingly.”

    Please check the Network Time Protocol (NTP) daemon man page and
    for further information.

    You can replace the ntpdate call with “rcntp ntptimeset” to achieve an
    inital poll of the servers specified in /etc/ntp.conf.

    The program /usr/sbin/sntp offers comparable functionality to ntpdate.


    sntp -P no -r [our internal server ip] ===> Worked

  • Ranjan Jul 29, 2013 @ 17:33

    Hallo Sir,

    How to set all my servers time table as my own server time in my Network ??? Is it possible & How ??? Can you please tell me the answer please … I am desperately want the replay sir…. THANKS in Advance.

  • idm Mar 4, 2014 @ 7:01

    Dear Sir,

    How to minimize drift (dippresion ) in NTP master and client server.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum