From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 27 08:39:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA08D16A4B3 for ; Mon, 27 Oct 2003 08:39:46 -0800 (PST) Received: from mx2.fillmore-labs.com (lima.fillmore-labs.com [62.138.193.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id E390743FDD for ; Mon, 27 Oct 2003 08:39:37 -0800 (PST) (envelope-from eikemeier@fillmore-labs.com) Received: from pd951a39b.dip.t-dialin.net ([217.81.163.155] helo=fillmore-labs.com ident=0oupbh8kgqazljoe) by mx2.fillmore-labs.com with asmtp (TLSv1:AES256-SHA:256) (Exim 4.24; FreeBSD 4.9) id 1AEAP1-000LEB-Fl; Mon, 27 Oct 2003 17:39:35 +0100 Message-ID: <3F9D4A45.8070400@fillmore-labs.com> Date: Mon, 27 Oct 2003 17:39:33 +0100 From: Oliver Eikemeier MIME-Version: 1.0 To: Dan Langille References: <3F9CF3F6.8307.ABC1250@localhost> In-Reply-To: <3F9CF3F6.8307.ABC1250@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: eikemeier@fillmore-labs.com User-Agent: KMail/1.5.9 Organization: Fillmore Labs GmbH X-Complaints-To: abuse@fillmore-labs.com cc: freebsd-hackers@freebsd.org Subject: Re: non-root process and PID files X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2003 16:39:46 -0000 Dan Langille wrote: > If a process starts up and does a setuid, should it be writing the > PID file before or after the setuid? > > Two methods exists AFAIK: > > 1 - write your PID immediately, and the file is chown root:wheel > 2 - write your PID to /var/run/myapp/myapp.pid where /var/run/myapp/ > is chown myapp:myapp > > Of the two, I think #1 is cleaner as it does not require another > directory with special permissions. You may have problems removing the file on exit, though.