Your web hosting partners since 2004.
Buy now »

How to setup a NTPd

When time on a virtual server drifts too much, you need to correct it, especially for security reasons, as one of the requirements for SSH connections is that time is accurate (within reason).

If you're running cPanel/WHM and you try to "Sync Time with Time Server", you'll get the following error:

Container environment detected - rdate skipped

This means you need to install NTP on the hardware node.

To install NTP, you'll want to do the following:

# yum -y install ntp

Once installed, you can sync the server by running:

# ntpdate uk.pool.ntp.org
 4 Feb 17:13:20 ntpdate[972086]: step time server 85.199.214.101 offset 546.812749 sec

To enable the ntpdate service, use the following command:

# chkconfig ntpdate on
Note: Forwarding request to 'systemctl enable ntpd.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

To start the service use:

# systemctl start ntpdate

You can then check it's running by doing:

# systemctl status ntpdate
● ntpdate.service - Set time via NTP
   Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; enabled; vendor preset: enabled)
   Active: active (exited) since Sat 2023-02-04 17:32:23 GMT; 3s ago
  Process: 975805 ExecStart=/usr/libexec/ntpdate-wrapper (code=exited, status=0/SUCCESS)
 Main PID: 975805 (code=exited, status=0/SUCCESS)

Last updated: 2023-02-04

« Go Back

Order now »

Quick and easy...