The philosophy behind use of 'su -' (or lack thereof)

Owen LaGarde owen.m.lagarde at usace.army.mil
Wed May 28 03:13:29 CEST 2008


A borderline-nagios-dev question:

Line 127 of the initscript (/etc/rc.d/init.d/nagios) uses 'su -' to
touch files on startup -- presumably to inherit the default uid/gid of
the container account if the 'touch' namespace causes file creation...

   su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"

Use of 'su -', of course, requires the container account to be login
enabled.  Two lines later the exact same task happens again but without
the login shell requirement...

   touch $NagiosRunFile
   chown $NagiosUser:$NagiosGroup $NagiosRunFile

Any particular reason for the two very different methods of performing
the same task, or why both can't use the latter form so that the nagios
user can be login disabled?  The utils code uses setuid() and setsid(),
so it's not like a login shell is actually needed....


-- 
Sincerely,

    Owen LaGarde
    Senior Systems Administrator
    Owen.M.LaGarde at erdc.usace.army.mil
    1-800-522-6937 x4879

Engineering Research and Development Center
attn: CEERD-IH-C (Owen LaGarde)
3909 Halls Ferry Road
Vicksburg, MS 39180-6199
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080527/22ae8e80/attachment.sig>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list