.\" Copyright (C) 2003 Andries Brouwer (aeb@cwi.nl)
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.TH PATH_RESOLUTION 7 2009-12-05 "Linux" "Linux Programmer's Manual"
.SH NAME
.SH DESCRIPTION
Some UNIX/Linux system calls have as parameter one or more filenames.
A filename (or pathname) is resolved as follows.
-.SS "Step 1: Start of the resolution process"
+.SS Step 1: start of the resolution process
If the pathname starts with the \(aq/\(aq character,
the starting lookup directory
is the root directory of the calling process.
Pathnames starting with a \(aq/\(aq character are called absolute pathnames.
Pathnames not starting with a \(aq/\(aq are called relative pathnames.
-.SS "Step 2: Walk along the path"
+.SS Step 2: walk along the path
Set the current lookup directory to the starting lookup directory.
Now, for each nonfinal component of the pathname, where a component
is a substring delimited by \(aq/\(aq characters, this component is looked up
.\" presently: max recursion depth during symlink resolution: 5
.\" max total number of symbolic links followed: 40
.\" _POSIX_SYMLOOP_MAX is 8
-.SS "Step 3: Find the final entry"
+.SS Step 3: find the final entry
The lookup of the final component of the pathname goes just like
that of all other components, as described in the previous step,
with two differences: (i) the final component need not be a
The details on the treatment
of the final entry are described in the manual pages of the specific
system calls.
-.SS ". and .."
+.SS . and ..
By convention, every directory has the entries "." and "..",
which refer to the directory itself and to its parent directory,
respectively.
The path resolution process will assume that these entries have
their conventional meanings, regardless of whether they are
-actually present in the physical file system.
+actually present in the physical filesystem.
One cannot walk down past the root: "/.." is the same as "/".
-.SS "Mount points"
+.SS Mount points
After a "mount dev path" command, the pathname "path" refers to
-the root of the file system hierarchy on the device "dev", and no
+the root of the filesystem hierarchy on the device "dev", and no
longer to whatever it referred to earlier.
-One can walk out of a mounted file system: "path/.." refers to
+One can walk out of a mounted filesystem: "path/.." refers to
the parent directory of "path",
-outside of the file system hierarchy on "dev".
-.SS "Trailing slashes"
+outside of the filesystem hierarchy on "dev".
+.SS Trailing slashes
If a pathname ends in a \(aq/\(aq, that forces resolution of the preceding
component as in Step 2: it has to exist and resolve to a directory.
-Otherwise a trailing \(aq/\(aq is ignored.
+Otherwise, a trailing \(aq/\(aq is ignored.
(Or, equivalently, a pathname with a trailing \(aq/\(aq is equivalent to
the pathname obtained by appending \(aq.\(aq to it.)
-.SS "Final symlink"
+.SS Final symlink
If the last component of a pathname is a symbolic link, then it
depends on the system call whether the file referred to will be
the symbolic link or the result of path resolution on its contents.
will operate on the symlink, while
.BR stat (2)
operates on the file pointed to by the symlink.
-.SS "Length limit"
+.SS Length limit
There is a maximum length for pathnames.
If the pathname (or some
intermediate pathname obtained while resolving symbolic links)
is too long, an
.B ENAMETOOLONG
error is returned ("Filename too long").
-.SS "Empty pathname"
+.SS Empty pathname
In the original UNIX, the empty pathname referred to the current directory.
Nowadays POSIX decrees that an empty pathname must not be resolved
successfully.
Linux returns
.B ENOENT
in this case.
-.SS "Permissions"
+.SS Permissions
The permission bits of a file consist of three groups of three bits, cf.\&
.BR chmod (1)
and
changed by the system call
.BR setfsuid (2).
-(Here "fsuid" stands for something like "file system user ID".
+(Here "fsuid" stands for something like "filesystem user ID".
The concept was required for the implementation of a user space
NFS server at a time when processes could send a signal to a process
with the same effective user ID.
Nobody should use
.BR setfsuid (2).)
-Similarly, Linux uses the fsgid ("file system group ID")
+Similarly, Linux uses the fsgid ("filesystem group ID")
instead of the effective group ID.
See
.BR setfsgid (2).
-.\" FIXME say something about file system mounted read-only ?
-.SS "Bypassing permission checks: superuser and capabilities"
+.\" FIXME . say something about filesystem mounted read-only ?
+.SS Bypassing permission checks: superuser and capabilities
On a traditional UNIX system, the superuser
.RI ( root ,
user ID 0) is all-powerful, and bypasses all permissions restrictions
On Linux, superuser privileges are divided into capabilities (see
.BR capabilities (7)).
Two capabilities are relevant for file permissions checks:
-\fBCAP_DAC_OVERRIDE\fP and \fBCAP_DAC_READ_SEARCH\fP.
+.B CAP_DAC_OVERRIDE
+and
+.BR CAP_DAC_READ_SEARCH .
(A process has these capabilities if its fsuid is 0.)
-The \fBCAP_DAC_OVERRIDE\fP capability overrides all permission checking,
-but only grants execute permission when at least one
+The
+.B CAP_DAC_OVERRIDE
+capability overrides all permission checking,
+but grants execute permission only when at least one
of the file's three execute permission bits is set.
-The \fBCAP_DAC_READ_SEARCH\fP capability grants read and search permission
+The
+.B CAP_DAC_READ_SEARCH
+capability grants read and search permission
on directories, and read permission on ordinary files.
-.\" FIXME say something about immutable files
-.\" FIXME say something about ACLs
-.SH "SEE ALSO"
+.\" FIXME . say something about immutable files
+.\" FIXME . say something about ACLs
+.SH SEE ALSO
.BR readlink (2),
.BR capabilities (7),
.BR credentials (7),
.BR symlink (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.