startup daemon as unpriviliged user
Erik Trulsson
ertr1013 at student.uu.se
Sat Feb 14 05:04:39 PST 2004
On Sat, Feb 14, 2004 at 06:28:29AM -0600, Eric F Crist wrote:
> On Saturday 14 February 2004 03:01 am, Uwe Doering wrote:
> > matthew wrote:
> > > On Fri, 13 Feb 2004, Louis LeBlanc wrote:
> > >>[...]
> > >>So, how can I get a process to run automatically on startup for an
> > >>unprivileged user?
> > >
> > > cd /usr/local/etc/rc.d
> > >
> > > make a small sh script like so:
> > >
> > > #!/bin/sh
> > > su username -c "command"
> >
> > For scripts in '/usr/local/etc/rc.d' one should stick to the required
> > semantics. That is, in this particular case you need to make sure that
> > it only runs on startup and not a second time on shutdown. Like so:
> >
> > ------------------------ cut here ------------------------
> > #!/bin/sh
> >
> > case "$1" in
> > start)
> > su username -c "command"
> > ;;
> > stop)
> > ;;
> > esac
> > ------------------------ cut here ------------------------
> >
> > Also, keep in mind that the script's name requires a suffix of '.sh', or
> > else the system won't execute it automatically.
> >
> > Uwe
>
>
> I think you could also setuid for that user to the shell script.
No, the setuid flag does not work for shell scripts.
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se
More information about the freebsd-questions
mailing list