supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Wayne Marshall <wcm@b0llix.net>
To: Peter Hickman <peterhickman386@googlemail.com>
Cc: supervision@list.skarnet.org
Subject: Re: Getting a process to run as root
Date: Fri, 27 Apr 2012 13:13:29 +0200	[thread overview]
Message-ID: <20120427131329.4ebfc294@b0llix.net> (raw)
In-Reply-To: <CALxYQy7SK7zSctTS8oL02hD0mLgDvcA67Ug5vU5LJ=XRYepgEg@mail.gmail.com>

On Fri, 27 Apr 2012 10:18:52 +0100
Peter Hickman <peterhickman386@googlemail.com> wrote:
 
> Here is the /etc/sv/runsvdir-log_watcher/run file
> 
> #!/bin/sh
> 
> RUNIT_USER=log_watcher:root:adm
> 
> exec 2>&1
> exec chpst -u$RUNIT_USER runsvdir /home/log_watcher/service
> 
> I've tried a variety of combinations and values for the -u and
> -U settings to no avail
> 
> The program runs but when it attempts to access the log files
> it no longer has permission to do so (just like it was before
> I added the missing groups to the log_watcher user).
> 

I see evidence of more than a few problems here.  For example,
why would you be using runsvdir in a service definition?

Anyway, it would appear that your basic runit installation and
setup may be a little confused.  Hopefully some runit users here
will be able to give you some good suggestions.

BTW, if you should ever decide to give perp a try, you may be
pleased to find you don't have to mess around with any symlink
indirection to install your service.  Then I could suggest an
rc.main runscript for your "log_watcher" service that looks
something like this:

#!/bin/sh
# /etc/perp/log_watcher/rc.main

exec 2>&1

TARGET=${1}
SVNAME=${2}

RUNUID="log_watcher"
GROUPS="log_watcher:adm"

start() {
  echo "starting ${SVNAME}..."
  exec runuid -S ${GROUPS} ${RUNUID} /path/to/log_watcher
}

reset() {
  echo "resetting ${SVNAME}..."
  exit 0
}

eval ${TARGET} "$@"

### EOF

Wayne
http://b0llix.net/perp/



  reply	other threads:[~2012-04-27 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25 10:20 Peter Hickman
2012-04-25 13:07 ` Wayne Marshall
2012-04-26 15:11   ` Peter Hickman
2012-04-26 18:49     ` Wayne Marshall
2012-04-27  9:18       ` Peter Hickman
2012-04-27 11:13         ` Wayne Marshall [this message]
2012-04-27 13:44           ` Peter Hickman
2012-04-27 14:42             ` Peter Hickman
2012-04-27 14:56               ` Charlie Brady
2012-04-28  1:17                 ` Laurent Bercot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120427131329.4ebfc294@b0llix.net \
    --to=wcm@b0llix.net \
    --cc=peterhickman386@googlemail.com \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).