startup daemon as unpriviliged user

Uwe Doering gemini at
Sat Feb 14 01:01:04 PST 2004

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 ------------------------

case "$1" in
                 su username -c "command"
------------------------ 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 Doering         |  EscapeBox - Managed On-Demand UNIX Servers
gemini at  |

More information about the freebsd-questions mailing list