Configuring NTPd in Arch Linux
This tutorial deals with getting ntpd configured so that your system clock is set over the internet. So install ntpd like so:
pacman -S ntpIn order to get this working visit http://www.pool.ntp.org/ and select the correct region. Once you know which ntp servers you want to use add the servers to /etc/ntp.conf as shown below:
server 0.europe.pool.ntp.org iburst server 1.europe.pool.ntp.org iburst server 2.europe.pool.ntp.org iburst server 3.europe.pool.ntp.org iburst
substitute the servers for the correct servers in your region. The iburst option is recommended. Then we need to make sure that ntpd runs automatically so we add it to our DAEMONS section of the /etc/rc.conf file like so:
DAEMONS=(... !hwclock ntpd ...)
this disables the hardware clock and makes sure that ntpd is used instead to keep the time in sync.
Now lets just finally make sure ntpd runs as a non-root user and in a chroot environment for added security:
groupadd ntp useradd -r -d /var/lib/ntp -g ntp -s /bin/false ntp
then
chown -R ntp:ntp /var/lib/ntp
once you have created the user and group for ntpd and changed the permissions on the /var/lib/ntp directory you just need to edit /etc/conf.d/ntp-client.conf by editing the NTPD_ARGS line so it looks like this:
NTPD_ARGS="-g -i /var/lib/ntp -u ntp:ntp"
and edit /etc/ntp.conf so that the following line:
driftfile /var/lib/ntp/ntp.drift
reads:
driftfile /ntp.driftthen finally restart ntpd and it should work perfectly:
rc.d restart ntpd