From owner-freebsd-questions@FreeBSD.ORG Wed Feb 6 16:09:49 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01F0516A418 for ; Wed, 6 Feb 2008 16:09:49 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from be-well.ilk.org (dsl092-078-145.bos1.dsl.speakeasy.net [66.92.78.145]) by mx1.freebsd.org (Postfix) with ESMTP id B1C8E13C46B for ; Wed, 6 Feb 2008 16:09:48 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: by be-well.ilk.org (Postfix, from userid 1147) id A218F28449; Wed, 6 Feb 2008 11:09:47 -0500 (EST) To: "Zbigniew Szalbot" References: <94136a2c0802060751o7952c2f8w639139271c946e98@mail.gmail.com> From: Lowell Gilbert Date: Wed, 06 Feb 2008 11:09:47 -0500 In-Reply-To: <94136a2c0802060751o7952c2f8w639139271c946e98@mail.gmail.com> (Zbigniew Szalbot's message of "Wed\, 6 Feb 2008 16\:51\:20 +0100") Message-ID: <44d4rat6b8.fsf@be-well.ilk.org> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions Subject: Re: /usr/local/etc/rc.d/ scripts and non-root user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2008 16:09:49 -0000 "Zbigniew Szalbot" writes: > I have looked at my /usr/local/etc/rc.d/ and realized that the symlink > I put there has the root as owner. It all works but I would rather use > a non-root user for to run that script. > > $ ls -l /usr/local/etc/rc.d/ > lrwxr-xr-x 1 root wheel 40 May 9 2007 sender.sh -> > /usr/home/api/sender/start.sh > > So I tried: > $ sudo chown api /usr/local/etc/rc.d/sender.sh > > No error but no change either. The original start.sh file has user api > but the symlink is owned by root. > > How can I make sure that the file is indeed run as user api? I prefer to use cron(8) for this (it has an @reboot value for the crontab files), but for using startup scripts, I think the best way is to use su(1) in the script to execute particular commands.