X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=man%2Ffile-hierarchy.xml;h=f8694a4c0aa3f2aa75a8a7abe1ffee833500d426;hb=02ea24ca2a0aac854c4e9e7d712f6464c8b29e4a;hp=6ef726ec0537b1dfdf69105b9fa1416559186686;hpb=2f3d398a0546574a5a3c1b3fcae0cdbaae960753;p=elogind.git diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index 6ef726ec0..f8694a4c0 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -54,7 +54,7 @@ systemd1 system and service manager are organized based on a file system hierarchy inspired by UNIX, more - specificaly the hierarchy described in the File System Hierarchy specification and hier7. This @@ -74,12 +74,8 @@ root. Usually writable, but this is not required. Possibly a temporary file system (tmpfs). Not shared with - other hosts (unless read-only). The - administrator may create additional - top-level subdirectories in this tree, - if required and the name does not - conflict with any of the directories - listed below. + other hosts (unless read-only). + @@ -90,7 +86,7 @@ System Partition, also see systemd-boot-generator8. This directory is usually strictly local - the host, and should be considered + to the host, and should be considered read-only, except when a new kernel or boot loader is installed. This directory only exists on systems that @@ -124,9 +120,9 @@ system users. This directory and possibly the directories contained within it might only become available - or writable in late boot or even on - user login only. This directory might - be placed on limited-functionality + or writable in late boot or even only + after user authentication. This directory + might be placed on limited-functionality network file systems, hence applications should not assume the full set of file API is available on @@ -169,7 +165,7 @@ The place for small temporary files. This directory is usually mounted as - tmpfs instance, and + a tmpfs instance, and should hence not be used for larger files. (Use /var/tmp for @@ -185,11 +181,11 @@ certain time are usually automatically deleted. If applications find the environment variable - $TMP set they + $TMPDIR set they should prefer using the directory specified in it over directly referencing - /tmp. + /tmp (see environ7 for details). @@ -206,7 +202,7 @@ for system packages to place runtime data in. This directory is flushed on boot, and generally writable for - priviliged programs + privileged programs only. Always writable. @@ -225,7 +221,7 @@ /run/user Contains per-user runtime directories, each usually - invidually mounted + individually mounted tmpfs instances. Always writable, flushed at each reboot and when the user logs @@ -261,8 +257,9 @@ /usr/bin - Binaries for user - commands, that shall appear in the + Binaries and + executables for user commands, that + shall appear in the $PATH search path. It is recommended not to place binaries in this directory that are @@ -282,17 +279,16 @@ /usr/lib - Static vendor data - that is compatible with all + Static, private vendor + data that is compatible with all architectures (though not necessarily architecture-independent). Note that - this includes internal - executables or other binaries that are - not regularly invoked from a - shell. Such binaries may be for any - architecture supported by the - system. Do not place public libraries - in this directory, use + this includes internal executables or + other binaries that are not regularly + invoked from a shell. Such binaries + may be for any architecture supported + by the system. Do not place public + libraries in this directory, use $libdir (see below), instead. @@ -300,7 +296,7 @@ $libdir Location for placing - dynamic libraries in. The precise + dynamic libraries. The precise location depends on the operating system and the architecture, and is sometimes @@ -311,14 +307,17 @@ identifier. This directory should not be used for package-specific data, unless this data is - architecture-dependent, - too. + architecture-dependent, too. To query + $libdir for the + primary architecture of the system, + invoke + # pkg-config --variable=libdir systemd /usr/share Resources shared - betwen multiple packages, such as + between multiple packages, such as documentation, man pages, time zone information, fonts and other resources. Usually, the precise @@ -452,11 +451,11 @@ or similar calls should be used to make use of this directory. If applications find the environment - variable $TMP set - they should prefer using the directory - specified in it over directly - referencing - /var/tmp. + variable $TMPDIR + set they should prefer using the + directory specified in it over + directly referencing + /var/tmp (see environ7 for details). @@ -471,7 +470,7 @@ /dev The root directory for device nodes. Usually this directory - is mounted as + is mounted as a devtmpfs instance, but might be of a different type in sandboxed/containerized setups. This @@ -504,7 +503,7 @@ programs) or $XDG_RUNTIME_DIR (for user programs) instead of POSIX - shared memory segments, since they + shared memory segments, since those directories are not world-writable and hence not vulnerable to security-sensitive name @@ -615,16 +614,172 @@ + + Home Directory + + User applications may want to place files and + directories in the user's home directory. They should + follow the following basic structure. Note that some + of these directories are also standardized (though + more weakly) by the XDG + Base Directory Specification. + + + + ~/.cache + + Persistent user cache + data. User programs may place + non-essential data in this + directory. Flushing this directory + should have no effect on operation of + programs, except for increased + runtimes necessary to rebuild these + caches. If an application finds + $XDG_CACHE_HOME set + is should use the directory specified + in it instead of this + directory. + + + + ~/.config + + Application + configuration and state. When a new + user is created this directory will be + empty or not exist at + all. Applications should fall back to + defaults should their configuration or + state in this directory be missing. If + an application finds + $XDG_CONFIG_HOME set + is should use the directory specified + in it instead of this + directory. + + + + ~/.local/bin + + Executables that shall + appear in the user's + $PATH search + path. It is recommended not to place + executables in this directory that are + not useful for invocation from a + shell; these should be placed in a + subdirectory of + ~/.local/lib + instead. Care should be taken when + placing architecture-dependent + binaries in this place which might be + problematic if the home directory is + shared between multiple hosts with + different + architectures. + + + + ~/.local/lib + + Static, private vendor + data that is compatible with all + architectures. + + + + ~/.local/lib/arch-id + + Location for placing + public dynamic libraries. The architecture + identifier to use is defined on Multiarch Architecture Specifiers (Tuples) + list. + + + + ~/.local/share + + Resources shared + between multiple packages, such as + fonts or artwork. Usually, the precise + location and format of files stored + below this directory is subject to + specifications that ensure + interoperability. If + an application finds + $XDG_DATA_HOME set + is should use the directory specified + in it instead of this + directory. + + + + + + + + Unpriviliged Write Access + + Unpriviliged processes generally lack + write access to most of the hierarchy. + + The exceptions for normal users are + /tmp, + /var/tmp, + /dev/shm, as well as the home + directory $HOME (usually found + below /home) and the runtime + directory $XDG_RUNTIME_DIR (found + below /run/user) of the + user, which are all writable. + + For unpriviliged system processes only + /tmp, + /var/tmp and + /dev/shm are writable. If an + unpriviliged system process needs a private, writable + directory in /var or + /run, it is recommended to either + create it before dropping priviliges in the daemon + code, to create it via + tmpfiles.d5 + fragments during boot, or via the + RuntimeDirectory= directive of + service units (see + systemd.unit5 + for details). + + + + Node Types + + Unix file systems support different types of file + nodes, including regular files, directories, symlinks, + character and block device nodes, sockets and FIFOs. + + It is strongly recommended that + /dev is the only location below + which device nodes shall be placed. Similar, + /run shall be the only location + to place sockets and FIFOs. Regular files, + directories and symlinks may be used in all + directories. + + System Packages Developers of system packages should follow strict rules when placing their own files in the file system. The following table lists recommended - locations for specific types of files. + locations for specific types of files supplied by the + vendor. - System Package Data Location + System Package Vendor Files Locations @@ -637,7 +792,7 @@ /usr/bin - Package executables that shall appear in the $PATH executable search path, compiled for the primary architecture of the operating system. It is not recommended to place internal binaries or binaries that are not commonly invoked from the shell in this directory, such as daemon binaries. As this directory is shared with most other packages of the system special care should be take to pick unique names for files placed here, that are unlikely to clash with other package's files. + Package executables that shall appear in the $PATH executable search path, compiled for the primary architecture of the operating system. It is not recommended to place internal binaries or binaries that are not commonly invoked from the shell in this directory, such as daemon binaries. As this directory is shared with most other packages of the system special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files. $libdir @@ -645,7 +800,7 @@ /usr/lib/package - Private static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data. + Private, static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data. $libdir/package @@ -655,21 +810,45 @@ /usr/include/package Public C/C++ APIs of public shared libraries of the package. + + +
+ + Additional static vendor files may be installed + in the /usr/share hierarchy, to + the locations defined by the various relevant + specifications. + + During runtime and for local configuration and + state additional directories are defined: + + + System Package Variable Files Locations + + + + + + Directory + Purpose + + + /etc/package - System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a tmpfiles.d5 fragment may be used to copy or symlink the necessary files and directores from /usr/share/factory during boot, via the L or C directives. + System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a tmpfiles.d5 fragment may be used to copy or symlink the necessary files and directories from /usr/share/factory during boot, via the L or C directives. /run/package - Runtime data for the package. Packages must be able to create the necessary subdirectories in this tree on their own, since the directory is flushed automatically on boot. Alternatively, a tmpfiles.d5 fragment may be used to create the necessary directories during boot. + Runtime data for the package. Packages must be able to create the necessary subdirectories in this tree on their own, since the directory is flushed automatically on boot. Alternatively, a tmpfiles.d5 fragment may be used to create the necessary directories during boot. Alternatively, the RuntimeDirectory= directive of service units may be used (see systemd.unit5 for details.) /run/log/package - Runtime log data for the package. + Runtime log data for the package. As above, the package needs to make sure to create this directory if necessary, as it will be flushed on every boot. /var/cache/package - Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed done due to the need to rebuild any local cache files. + Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary. /var/lib/package @@ -677,11 +856,93 @@ /var/log/package - Persistent log data of the package. + Persistent log data of the package. As above, the package should make sure to create this directory if necessary, as it might be missing. /var/spool/package - Persistent spool/queue data of the package. + Persistent spool/queue data of the package. As above, the package should make sure to create this directory if necessary, as it might be missing. + + + +
+ + + + User Packages + + Programs running in user context should follow + strict rules when placing their own files in the + user's home directory. The following table lists + recommended locations in the home directory for + specific types of files supplied by the vendor if the + application is installed in the home directory. (Note + however, that user applications installed system-wide + should follow the rules outlined above regarding + placing vendor files.) + + + User Package Vendor File Locations + + + + + + Directory + Purpose + + + + + ~/.local/bin + Package executables that shall appear in the $PATH executable search path. It is not recommended to place internal executables or executables that are not commonly invoked from the shell in this directory, such as daemon executables. As this directory is shared with most other packages of the user special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files. + + + ~/.local/lib/arch-id + Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes. + + + ~/.local/lib/package + Private, static vendor resources of the package, compatible wih any architecture, or any other kind of read-only vendor data. + + + ~/.local/lib/arch-id/package + Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures. + + + +
+ + Additional static vendor files may be installed + in the ~/.local/share hierarchy, + to the locations defined by the various relevant + specifications. + + During runtime and for local configuration and + state additional directories are defined: + + + User Package Variable File Locations + + + + + + Directory + Purpose + + + + + ~/.config/package + User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing. + + + $XDG_RUNTIME_DIR/package + User runtime data for the package. + + + ~/.cache/package + Persistent cache data of the package. If this directory is flushed the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary. @@ -695,6 +956,9 @@ hier7, systemd-boot-generator8, sysctl.d5, + tmpfiles.d5, + pkg-config1, + systemd.unit5