starting a process as another user during startup

Leslie Mikesell les at chinet.chi.il.us
Fri May 17 01:26:25 AEST 1991


In article <8646 at alpha.cam.nist.gov> coleman at cam.nist.gov (Sean Sheridan Coleman X5672) writes:

>What I would like to do is have the rc.local run this script
>and start up this monitoring program as a part of its startup 
>but I want it to start the process so the user is nbsnet not
>root. Is there a way to do this and if so, how?

Use:
 su -c user "command string"

My (AT&T sysV) man page gives very little information about this form
but as I recall, it runs the users shell as per the passwd file as well
as using the uid, and if that shell is ksh, it will execute the user's
.profile, where sh will not (watch out for interactive commands!).

I prefer to let init respawn this kind of program, since it can then
exit under whatever conditions you want and a new copy will always
restart, and a screw-up like an interactive prompt won't hang the
machine like it does in the rc.d files.  You probably only want it
at run-level 2 and 3 anyway.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.wizards mailing list