1181834SrobertoStarting with NetBSD-1.6, it is possible to delegate the system clock 2181834Srobertocontrol to a non root user. This enable running ntpd in a chroot 3181834Srobertojail under a non privilegied UID/GID, using ntpd -i and -u flags. 4181834Sroberto 5181834SrobertoThe delegation is done through the clockctl(4) pseudodevice driver. 6181834SrobertoThis driver makes privilegied system calls such as ntp_adjtime(2) 7181834Srobertoavailable through ioctl(2) on the /dev/clockctl device. If a user 8181834Srobertois able to write to /dev/clockctl, then (s)he can control the system 9181834Srobertoclock. 10181834Sroberto 11181834SrobertoIn order to use this feature, make sure that: 12181834Sroberto 13181834Sroberto1) Your kernel is compiled with the following option: 14181834Srobertopseudo-device clockctl 15181834SrobertoThis is true for GENERIC kernels on most ports. Please check 16181834Srobertohttp://wwW.netbsd.org/Documentation/kernel/ 17181834Srobertoif you need information about building a kernel. 18181834Sroberto 19181834Sroberto2) You have a ntpd user on your system. Here is the /etc/master.passwd 20181834Srobertoentry for ntpd user on NetBSD-1.6: 21181834Srobertontpd:*:15:15::0:0:& pseudo-user:/var/chroot/ntpd:/sbin/nologin 22181834SrobertoAnd here is the /etc/group entry for group 15: 23181834Srobertontpd:*:15: 24181834Sroberto 25181834Sroberto3) /dev/clockctl exists and is writtable by user ntpd. Default 26181834SrobertoNetBSD-1.6 setting is: 27181834Srobertocrw-rw---- 1 root ntpd 61, 0 Apr 1 2002 /dev/clockctl 28181834SrobertoMajor device number and date is likely to be different on your system. 29181834SrobertoIf you need to create the device, issue the following command: 30181834Srobertocd /dev && ./MAKEDEV clockctl 31181834Sroberto 32181834SrobertoHere is an example of how to run ntpd chrooted in /var/chroot/ntpd, 33181834Srobertorunning with ntpd UID and ntpd GID: 34181834Srobertontpd -i /var/chroot/ntpd -u ntpd:ntpd 35181834SrobertoNote that -i and -u options are enabled at configure time if your 36181834Srobertosystem supports system clock control by an unprivilegied user. If this 37181834Srobertois not the case, then the -i and -u options will not be available. 38