[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ] [ next ]

Debian Policy Manual - Chapter 3
The Operating System


3.1 File system hierarchy


3.1.1 Linux File system Structure

The location of all installed files and directories must comply with the Linux File system Hierarchy Standard (FHS). The latest version of this document can be found alongside this manual or on http://www.pathname.com/fhs/.[2] Specific questions about following the standard may be asked on debian-devel, or referred to Daniel Quinlan, the FHS coordinator, at quinlan@pathname.com.


3.1.2 Site-specific programs

As mandated by the FHS no package should place any files in /usr/local, either by putting them in the file system archive to be unpacked by dpkg or by manipulating them in their maintainer scripts.

However, the package should create empty directories below /usr/local so that the system administrator knows where to place site-specific files. These directories should be removed on package removal if they are empty.

Note, that this applies only to directories below /usr/local, not in /usr/local. The directory /usr/local itself may only contain the sub-directories listed in FHS, section 4.6. However, you may create directories below them as you wish. You may not remove any of the directories listed in 4.6, even if you created them.

Since /usr/local may be mounted read-only from a remote server, these directories have to be created and removed by the postinst and prerm maintainer scripts. These scripts must not fail if either of these operations fail. (In the future, it will be possible to tell dpkg not to unpack files matching certain patterns, so that the directories can be included in the .deb packages and system administrators who do not wish these directories in /usr/local do not need to have them.)

For example, the emacs package will contain

     	      mkdir -p /usr/local/lib/emacs/site-lisp || true

in the postinst script, and

     	      rmdir /usr/local/lib/emacs/site-lisp && \
     	      rmdir /usr/local/lib/emacs || \
     	      true

in the prerm script.

If you do create a directory in /usr/local for local additions to a package, you must ensure that settings in /usr/local take precedence over the equivalents in /usr.

However, because '/usr/local' and its contents are for exclusive use of the local administrator, a package must not rely on the presence or absence of files or directories in '/usr/local' for normal operation.

The /usr/local directory itself and all the subdirectories created by the package should have permissions 2775 (group-writable and set-group-id) and be owned by root.staff.


3.2 Users and groups

The Debian system can be configured to use either plain or shadow passwords.

Some user ids (UIDs) and group ids (GIDs) are reserved globally for use by certain packages. Because some packages need to include files which are owned by these users or groups, or need the ids compiled into binaries, these ids must be used on any Debian system on