Red Hat Bugzilla – Bug 26894
daemon() in initscripts functions runs "su" incorrectly
Last modified: 2014-03-16 22:18:57 EDT
The daemon() function in /etc/rc.d/init.d/functions takes a "--user" option
which tries to run the daemon as that user:
nice -n $nicelevel initlog $INITLOG_ARGS -c "su $daemon_user -c \"$*\"" &&
success "$base startup" || failure "$base startup"
However this causes problems if the daemon makes assumptions about its
environment, for example $HOME remains set to /root, not the homedir of
$daemon_user. Obviously smart daemons make provisions for this type of
thing in their configuration, but I've encountered some third-party stuff
(namely Blackboard Courseinfo) that relies on the daemon user's
This can easily be fixed by running su as "su - $daemon_user ..." to run
the daemon in a "login" shell. It would probably reduce headaches if this
were the default behavior.
Will be fixed in 5.65-1 or so. Thanks!