6

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.

5
  • 3
    Why would you not have it ?
    – user9517
    Apr 3, 2016 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, 2016 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? Apr 3, 2016 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. Apr 3, 2016 at 23:33
  • What Zach said. This is an absurd "optimisation". You used more time and electricity asking this question. Apr 4, 2016 at 0:55

1 Answer 1

6

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.

10
  • 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, 2016 at 14:57
  • Yeah, running it regularry after boot is probably a wise thing to do.
    – Anubioz
    Apr 3, 2016 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, 2016 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, 2016 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. Apr 4, 2016 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .