[NTLUG:Discuss] Run Program as User From Init Scripts

Richard Cobbe cobbe at directlink.net
Thu Aug 16 07:22:24 CDT 2001


Lo, on Thursday, August 16, lee at brave.com did write:

> i'd like to run a program as a user from the init boot scripts.  for
> instance, i'd like to run fetchmail at boot time, but i don't want to run
> it as root, and besides, fetchmail is very picky about who runs the
> program (my config for fetchmail is in my home directory).
> 
> so how do i manipulate a rc.local file in the init scripts to call
> fetchmail (or any other program) but run it as a particular user?

Just use the following in your rc.local script:

su - <user> -c <command>

See su's manual page for more info.

Richard



More information about the Discuss mailing list