[NCLUG] starting a script at startup as specific user?

Gordon Forsythe baohx_2000 at yahoo.com
Fri Apr 27 01:59:48 MDT 2001


Thanks, Mark.  Didn't know you could su to a specific user.  I'll look at
the named script and get it figured out from there.  BTW, you assume
correctly on the distro.
  gordo

----- Original Message -----

On Thu, Apr 26, 2001 at 11:44:06PM -0600, Gordon Forsythe wrote:
> Hi everyone...can someone tell me a simple way to have a script run as a
> specific user when the box boots?  httpd runs as apache, so I am trying to
> figure out a way to do this for other things.  A friend told me to check
> init.d and rc.d...httpd is in init.d, but I do not see where in the script
> the user is specified.  I may be looking at this from the wrong angle too.
> Thanks in advance!
>   Gordon


Apache actually starts as root, then becomes another user; who this other
user is is set in httpd.conf, so that's rather specific to apache.

If you're using RedHat, take a look at how named starts up:

daemon named -u named

the "-u" argument specifies the user to start as.

The "daemon" command isn't a normal bash command, but comes from
/etc/rc.d/init.d/functions (again, I'm assuming RedHat).  You might want
to use /etc/rc.d/init.d/named as an example.

Whether or not you're using RedHat, you can also do something simple like
this:

su user -c command_to_run

(This is essentially what the daemon() function does.)

--
Mark Fassler
fassler at monkeysoft.net
_______________________________________________
NCLUG mailing list
NCLUG at nclug.org
http://www.nclug.org/mailman/listinfo/nclug


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the NCLUG mailing list