Bug 522949

Summary: init script could call daemon with user flag
Product: [Fedora] Fedora EPEL Reporter: Stefan Schulze Frielinghaus <fedoraproject>
Component: ejabberdAssignee: Peter Lemenkov <lemenkov>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: el5CC: lemenkov, mmahut, silfreed
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-14 12:48:31 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 Stefan Schulze Frielinghaus 2009-09-12 15:27:50 UTC
Is there any reason why we don't call

daemon --user=ejabberd /usr/sbin/ejabberdctl start

in the init script but instead call runuser in /usr/sbin/ejabberdctl

/sbin/runuser -s /bin/bash -p ejabberd -c "$ERL_COMMAND"

?

At least start/stop could be done via "daemon --user=ejabberd".

Comment 1 Peter Lemenkov 2009-09-14 11:17:54 UTC
I did it just for unification - ejabberd can be started and stopped not only by using init-script, but also by using ejabberdctl (and vice versa). That's why I thought - why not to sed user in one common place, and, since init-script is using ejabberdctl actually, I decided to set uid within it.

Please, tell us your opinion regarding this, and what do you think - should I modify this scheme and explicitly add "--user" parameter in init-script?

Comment 2 Stefan Schulze Frielinghaus 2009-09-14 12:48:31 UTC
(In reply to comment #1)
> I did it just for unification - ejabberd can be started and stopped not only by
> using init-script, but also by using ejabberdctl (and vice versa).

Ah OK. This makes sense. In this case I wouldn't use the "daemon --user" option because then you would need a hack like 'if `id -un` -eq "ejabberd"; then ...' in the ejabberdctl script. I would say your solution is perfectly fine under this circumstances. Because in the end "daemon --user" does nothing else then calling runuser too.

I closed this bug, thanks for clarification!