Environment of daemon when starting with sudo

Hello everyone

Our rc script contains user and group settings.
Code:
user=someuser
group=somegroup

The daemon that is started by this script still has the environment of the user that has started it i.e. with "sudo /usr/local/etc/rc.d/some_rc.sh start". This is the output of /usr/bin/env when called by the started daemon when the user james started it with "sudo ...":
Code:
SUDO_GID=1001
USER=root
MAIL=/var/mail/james
HOME=/home/james
SUDO_UID=1001
LOGNAME=root
TERM=xterm
USERNAME=root
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
SUDO_COMMAND=/usr/local/etc/rc.d/some_rc.sh start
SHELL=/usr/local/bin/bash
SUDO_USER=james

How can I change the environment to the user that is defined in the rc-script (i.e. "someuser" as in the example above)?


Thanks for your help
James
 
Start the application in the rc script with su to change it to run on someuser.
 
Back
Top