1
Starting with NetBSD-1.6, it is possible to delegate the system clock
2
control to a non root user. This enable running ntpd in a chroot
3
jail under a non privilegied UID/GID, using ntpd -i and -u flags.
5
The delegation is done through the clockctl(4) pseudodevice driver.
6
This driver makes privilegied system calls such as ntp_adjtime(2)
7
available through ioctl(2) on the /dev/clockctl device. If a user
8
is able to write to /dev/clockctl, then (s)he can control the system
11
In order to use this feature, make sure that:
13
1) Your kernel is compiled with the following option:
14
pseudo-device clockctl
15
This is true for GENERIC kernels on most ports. Please check
16
http://wwW.netbsd.org/Documentation/kernel/
17
if you need information about building a kernel.
19
2) You have a ntpd user on your system. Here is the /etc/master.passwd
20
entry for ntpd user on NetBSD-1.6:
21
ntpd:*:15:15::0:0:& pseudo-user:/var/chroot/ntpd:/sbin/nologin
22
And here is the /etc/group entry for group 15:
25
3) /dev/clockctl exists and is writtable by user ntpd. Default
26
NetBSD-1.6 setting is:
27
crw-rw---- 1 root ntpd 61, 0 Apr 1 2002 /dev/clockctl
28
Major device number and date is likely to be different on your system.
29
If you need to create the device, issue the following command:
30
cd /dev && ./MAKEDEV clockctl
32
Here is an example of how to run ntpd chrooted in /var/chroot/ntpd,
33
running with ntpd UID and ntpd GID:
34
ntpd -i /var/chroot/ntpd -u ntpd:ntpd
35
Note that -i and -u options are enabled at configure time if your
36
system supports system clock control by an unprivilegied user. If this
37
is not the case, then the -i and -u options will not be available.