Determining User Access on a Linux Filesystem with „Classic Permissions“

Absolute Paths and Path Components

Every file on a Linux filesystem has at least one path relative to the root directory „/“. This path is called an „absolute path“ of the file or directory. The directories leading up to the file, separated by forward slashes „/“, are called the „components“ of the path. The root directory „/“ is an implicit first component of every absolute path. The last component, the name of the file itself, is called the „base name“ of the file or directory.

For example, my home directory has an absolute path „/home/tilman“, where the components are „/“, „home“ and „tilman“, with „tilman“ being the base name of the directory.

A file or directory can have multiple absolute paths, if symbolic links exist that point to any of their components.

For example:

mkdir /tmp/directory
ln -si /tmp/directory /tmp/directory/entry

Now, „/tmp/directory“, „/tmp/directory/entry“, „/tmp/directory/entry/entry“ etc. are all absolute paths of the same directory.

Note that on many Linux filesystems each directory holds two „virtual“ directory entries „.“ and „..“. „.“ is an alias for the current directory. „..“ is an alias for the parent directory or, if the current directory is the root directory, to the directory itself. On such filesystems, every absolute path can be extended by insertions of „.“, „..“ and repeated components into the ist of path components. For example the following are all absolute paths to „/etc/passwd“: „/etc/passwd“, „/etc/./passwd“, „/etc/../etc/passwd“, „/etc/../../../../etc/././passwd“.

Not taking into account techniques such as „bind-mounts“ and „mount namespaces“ (see Observations and Caveats below) and the special behavior exposed by some „virtual filesystems“ such as „sysfs“, there is exactly one absolute path to every file and directory in a Linux filesystem that contains no components „.“ and „..“ and has all symbolic links dereferenced to the locations they point to. This is called the „absolute de-referenced path“ of that file or directory.