From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: bug#24366: [PATCH] gnu: Use a directory owned by ntpd user for drift file. Date: Tue, 6 Sep 2016 21:05:21 +0200 Message-ID: <1473188721-15624-1-git-send-email-jmd@gnu.org> References: <20160904204353.GA515@jasmine> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhLi7-0007ey-IG for bug-guix@gnu.org; Tue, 06 Sep 2016 15:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhLi2-0004hD-AT for bug-guix@gnu.org; Tue, 06 Sep 2016 15:07:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:54003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhLi2-0004h3-6s for bug-guix@gnu.org; Tue, 06 Sep 2016 15:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bhLi1-0000jm-Vn for bug-guix@gnu.org; Tue, 06 Sep 2016 15:07:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20160904204353.GA515@jasmine> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 24366@debbugs.gnu.org Cc: John Darrington I think this fixes the problem. What do you think? * gnu/services/networking.scm (ntp-shepherd-service): Create new directory at startup. --- gnu/services/networking.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 71f49a0..714dc80 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -271,8 +271,11 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." (($ ntp servers) (let () ;; TODO: Add authentication support. + (define %user + (getpw "ntpd")) + (define config - (string-append "driftfile /var/run/ntp.drift\n" + (string-append "driftfile /var/run/ntpd/ntp.drift\n" (string-join (map (cut string-append "server " <>) servers) "\n") @@ -294,6 +297,8 @@ restrict -6 ::1\n")) (documentation "Run the Network Time Protocol (NTP) daemon.") (requirement '(user-processes networking)) (start #~(make-forkexec-constructor + (mkdir-p "/var/run/ntpd") + (chown "/var/run/nptd" (passwd:uid %user) (passwd:gid %user)) (list (string-append #$ntp "/bin/ntpd") "-n" "-c" #$ntpd.conf "-u" "ntpd"))) (stop #~(make-kill-destructor)))))))) -- 2.1.4