the proper owner/group for /var/log and /var/run entries?

Robert P. J. Day rpjday at crashcourse.ca
Sun Jul 4 07:00:39 UTC 2010


  not sure if this is the right forum but i have a couple questions
about the proper attributes for /var/log and /var/run entries for a
newly-installed package (and perhaps other /var directories as well).

  i'm playing with a new package, it comes in .deb form, call it
"pkg".  as part of the installation process, it creates two new
directories with the equivalent owner/group:

d  pkg pkg  /var/run/pkg
d  pkg pkg  /var/log/pkg

  the purpose of the above is obvious -- those /var directories will
keep track of log info and PID info for that package.  and since the
package runs with owner and group of "pkg" and "pkg", it will clearly
have the access rights to write contents into those directories.
also, since the installation process runs as root, installation will
have the right to *create* those directories in the first place.  so
far, so good?  but here's where something has gone wrong.

  for reasons i don't understand, during shutdown or system reboot or
*something*, those two directories disappeared.  i don't see why, they
just did.  and once they did, trying to *start* that package again is
clearly going to run into all sorts of trouble since, because the
package runs with the owner and group of "pkg" and "pkg", it will
certainly not be allowed to *recreate* those directories under
/var/log and /var/run -- that requires root privilege, yes?  and
without those directories, i won't have any logging info, and i won't
be able to properly run the init script if it needs to query the
package's PID (since there won't be any /var/run/pkg/pid file).

  does any of this make sense?  i'm looking at the standard
directories in /var/log and /var/run, and i see very few that have
similar attributes to the ones i mentioned here.  one exception is
/var/run/avahi-daemon, which has owner and group avahi and avahi, so
it's possible that it could end up in the same weird situation.

  am i overly worried about this?  typically, once the appropriate
directories are created at install time, i would expect them to stay
there so this quirk would never arise.  and i have no idea how the
problem came about in the first place, but somehow it did and it's
caused exactly the problem as i described it.

  thoughts?  recommendations?  link to web page that explains best
practices?

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Top-notch, inexpensive online Linux/OSS/kernel courses
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the ubuntu-users mailing list