Bug 26894

Summary: daemon() in initscripts functions runs "su" incorrectly
Product: [Retired] Red Hat Linux Reporter: Jeremy Portzer <jeremyp>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: dr, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-02-12 14:53:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeremy Portzer 2001-02-09 23:30:23 UTC
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
environment.  

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.

Comment 1 Bill Nottingham 2001-02-16 19:17:59 UTC
Will be fixed in 5.65-1 or so. Thanks!