Bug 522949 - init script could call daemon with user flag
Summary: init script could call daemon with user flag
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: ejabberd
Version: el5
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Peter Lemenkov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-09-12 15:27 UTC by Stefan Schulze Frielinghaus
Modified: 2009-09-14 12:48 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-14 12:48:31 UTC


Attachments (Terms of Use)

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!


Note You need to log in before you can comment on or make changes to this bug.