Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Feb 2008 11:09:47 -0500
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        "Zbigniew Szalbot" <zszalbot@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: /usr/local/etc/rc.d/ scripts and non-root user
Message-ID:  <44d4rat6b8.fsf@be-well.ilk.org>
In-Reply-To: <94136a2c0802060751o7952c2f8w639139271c946e98@mail.gmail.com> (Zbigniew Szalbot's message of "Wed\, 6 Feb 2008 16\:51\:20 %2B0100")
References:  <94136a2c0802060751o7952c2f8w639139271c946e98@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Zbigniew Szalbot" <zszalbot@gmail.com> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44d4rat6b8.fsf>