Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wrote a package, and would like to use /var to persist some data. The data I'm storing would perhaps even be thought of as an addition for /var/db.

The pattern I observe is that files in /var/db, and the surrounds, are owned by root. The primary (intended) use of the package filters cron jobs - meaning you would need permissions to edit the crontab.

  1. Should I presume a sudo install of the package?
  2. Should I have the package gracefully degrade to a /usr subdir, and if so then which one?
  3. If I 'opinionate' that any non-sudo install requires a configrc (with paths), where should the package look (presuming a shared-host environment) for that config file?

Incidentally, this package is a ruby gem, and you can find it here.

share|improve this question
Personally think this question is more suitable for unix.stackexchange.com forum. –  laika Oct 25 '12 at 15:28
@skrco Please don't direct users to other sites when their question is absolutely fine to stay here. We have almost 15.000 Linux and Unix questions on Super User – we don't need to push questions away. –  slhck Oct 25 '12 at 15:34

1 Answer 1

If you want to follow the Linux Filesystem Hierarchy Standard (http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard and http://refspecs.linuxfoundation.org/fhs.shtml) (which, as Linux sysadmin, I'd highly recommend) you should use /var/lib/<your application name> to store persistent data:

/var/lib holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. Users must never need to modify files in /var/lib to configure a package's operation.

An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. There is one required subdirectory, /var/lib/misc, which is intended for state files that don't need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution.

This means the package should be indeed installed with sudo. On the other hand, notice that any subdirectory in /usr (/user/local would be a second possibility) would require sudo too, since they belong to root. So if you want to fall back to a non-sudo installation, I'd say ~/bin is a good choice.

The package itself only needs to run as root if it's used to edit other users' crontabs.

As of configrc, if you mean this: https://github.com/nerab/config-rc I can't give you any piece of advice because I don't know it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.