Do I need ntpd daemon / service on an LAMP server running Linux Debian 8.3?

I have already disabled some obvious services, but I am not sure about this one.

  • 3
    Why would you not have it ? – Iain Apr 3 '16 at 14:08
  • 1
    Dedicated or virtual? Some virtual hosts provide a sync'd clock, you would have to check with your provider. They may also provide a local ntpd for you to sync against. – pete Apr 3 '16 at 14:28
  • 7
    By my math, that's 0.2% of your CPU time going to ntpd. In the spirit of avoiding premature optimization, surely you have bigger priorities? – Zach Lipton Apr 3 '16 at 18:18
  • Doesn't the M in LAMP stand for MySQL? I'd be sure to run a time synch tool if I was running a database. – Jeff Schaller Apr 3 '16 at 23:33
  • What Zach said. This is an absurd "optimisation". You used more time and electricity asking this question. – Lightness Races in Orbit Apr 4 '16 at 0:55
up vote 7 down vote accepted

A typical single LAMP doesn't usually need a full-blown NTP server - to keep your time accurate add a ntpd -q job to run every day.

You need an NTP server when more accurate time synchronization is required (like in a case of cloud-based service, distributed along a number of instances) or when your software have issues with jumping clocks (since ntpdate (which actually is deprecated in favor of ntpd -q) will directly set the time instead of slowly adjusting it).

If you choose to run ntpd, make sure you add a firewall rule to block incoming connections, since it is a widely-known target for NTP Amplification DDoS attack - having it open to the wild will cause high traffic usage and abuse letters to your hosting company. Run ntpd -q once at startup before starting ntpd to get the benefits of the better tool.

  • 1
    I'd run ntpdate daily or hourly. Computer clocks drift and being confidant in the times in your logs is nice. – chicks Apr 3 '16 at 14:57
  • Yeah, running it regularry after boot is probably a wise thing to do. – Anubioz Apr 3 '16 at 15:22
  • 2
    You can just set a firewall rule to prevent ntpd becoming a target for this. Also, ntpdate will be less accurate, it will not discipline the clock to minimize skew and for errors greater then 0.5 seconds, it will directly set the time instead of slowly adjusting it, which can cause issues with some software that doesn't like jumping clocks. Run ntpdate once at startup before starting ntpd and then get the benefits of the better tool. Oh, and ntpdate is deprecated and will go away at some point and ntpd -q will do it's job. – Sven Apr 3 '16 at 15:25
  • 3
    ntpdate (or equivalent) on a cron is not a good solution. Please do more research before doing that. The NTP reflection issue has been fixed in any sort of modern version of ntpd. The relevant function (monlist) has been removed, so that's not really a concern. – devicenull Apr 3 '16 at 22:49
  • 4
    Periodic time jumps are bad. Keep ntpd running to get rid of that drift. You'll be grateful for it later when all your timestamps aren't wrong and you're trying to diagnose something. – Lightness Races in Orbit Apr 4 '16 at 0:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.