HOME

TheInfoList



OR:

Most
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
s include attributes of files and directories that control the ability of users to read, change, navigate, and
execute Execute, in capital punishment, is to put someone to death. Execute may also refer to: *Execution (computing), the running of a computer program * ''Execute'' (album), a 2001 Garage hip-hop album by Oxide & Neutrino * USS ''Execute'' (AM-232), an ...
the contents of the file system. In some cases, menu options or functions may be made visible or hidden depending on a user's permission level; this kind of
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
is referred to as permission-driven. Two types of permissions are widely available: traditional Unix file system permissions and
access-control list In computer security, an access-control list (ACL) is a list of permissions associated with a system resource (object). An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on give ...
s (ACLs) which are capable of more specific control.


File system variations

The original
File Allocation Table File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. It is often supported for compatibility reasons by ...
file system has a per-file all-user read-only attribute.
NTFS New Technology File System (NTFS) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family. It superseded File Allocation Table (FAT) as the preferred fil ...
implemented in
Microsoft Windows NT Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Win ...
and its derivatives, use ACLs to provide a complex set of permissions.
OpenVMS OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
uses a permission scheme similar to that of Unix. There are four categories (system, owner, group, and world) and four types of access permissions (Read, Write, Execute and Delete). The categories are not mutually disjoint: World includes Group, which in turn includes Owner. The System category independently includes system users. HFS implemented in
Classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. The ...
operating systems, do not support permissions.
Mac OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
versions 10.3 ("Panther") and prior use POSIX-compliant permissions. Mac OS X, beginning with version 10.4 ("Tiger"), also support the use of NFSv4 ACLs. They support "traditional Unix permissions" as used in previous versions of Mac OS X, and the ''Apple Mac OS X Server version 10.4+ File Services Administration Manual'' recommends using only traditional Unix permissions if possible. It also still supports the Mac OS Classic's "Protected" attribute.
Solaris Solaris may refer to: Arts and entertainment Literature, television and film * ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem ** ''Solaris'' (1968 film), directed by Boris Nirenburg ** ''Solaris'' (1972 film), directed by ...
ACL support depends on the filesystem being used; older UFS filesystem supports POSIX.1e ACLs, while
ZFS ZFS (previously: Zettabyte File System) is a file system with volume management capabilities. It began as part of the Sun Microsystems Solaris operating system in 2001. Large parts of Solaris – including ZFS – were published under an ope ...
supports only NFSv4 ACLs.
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
supports
ext2 The ext2 or second extended file system is a file system for the Linux kernel. It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed according to the same pr ...
,
ext3 ext3, or third extended filesystem, is a journaled file system that is commonly used by the Linux kernel. It used to be the default file system for many popular Linux distributions. Stephen Tweedie first revealed that he was working on extend ...
,
ext4 ext4 (fourth extended filesystem) is a journaling file system for Linux, developed as the successor to ext3. ext4 was initially a series of backward-compatible extensions to ext3, many of them originally developed by Cluster File Systems for ...
,
Btrfs Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or simply by spelling it out) is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (not to be confused ...
and other file systems many of which include POSIX.1e ACLs. There is experimental support for NFSv4 ACLs for ext3 and ext4 filesystems.
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
supports POSIX.1e ACLs on UFS, and NFSv4 ACLs on UFS and ZFS. IBM z/OS implements file security using RACF (Resource Access Control Facility) The AmigaOS Filesystem, AmigaDOS supports a permissions system relatively advanced for a single-user OS. In AmigaOS 1.x, files had Archive, Read, Write, Execute and Delete (collectively known as ARWED) permissions/flags. In AmigaOS 2.x and higher, additional Hold, Script, and Pure permissions/flags were added.


Traditional Unix permissions

Permissions on
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
file systems are managed in three scopes or classes known as ''user'', ''group'', and ''others''. When a file is created its permissions are restricted by the
umask In computing, umask is a command (computing), command that determines the settings of a Mask (computing), mask that controls how file permissions are set for newly created files. It may also affect how the file permissions are changed explicitly. ...
of the process that created it.


Classes

Files and
directories Directory may refer to: * Directory (computing), or folder, a file system structure in which to store computer files * Directory (OpenVMS command) * Directory service, a software application for organizing information about a computer network's u ...
are owned by a user. The owner determines the file's ''user class''. Distinct permissions apply to the owner. Files and directories are assigned a
group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic iden ...
, which define the file's ''group class.'' Distinct permissions apply to members of the file's group. The owner may be a member of the file's group. Users who are not the owner, nor a member of the group, comprise a file's ''others class''. Distinct permissions apply to others. The ''effective permissions'' are determined based on the first class the user falls within in the order of user, group then others. For example, the user who is the owner of the file will have the permissions given to the user class regardless of the permissions assigned to the group class or others class.


Permissions

Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems implement three specific permissions that apply to each class: * The ''read'' permission grants the ability to read a file. When set for a directory, this permission grants the ability to read the names of files in the directory, but not to find out any further information about them such as contents, file type, size, ownership, permissions. * The ''write'' permission grants the ability to modify a file. When set for a directory, this permission grants the ability to modify entries in the directory, which includes creating files, deleting files, and renaming files. Note that this requires that ''execute'' is also set; without it, the write permission is meaningless for directories. * The ''execute'' permission grants the ability to execute a file. This permission must be set for executable programs, in order to allow the operating system to run them. When set for a directory, the execute permission is interpreted as the ''search'' permission: it grants the ability to access file contents and meta-information if its name is known, but not list files inside the directory, unless ''read'' is set also. The effect of setting the permissions on a directory, rather than a file, is "one of the most frequently misunderstood file permission issues". When a permission is not set, the corresponding rights are denied. Unlike ACL-based systems, permissions on Unix-like systems are not inherited. Files created within a directory do not necessarily have the same permissions as that directory.


Changing permission behavior with setuid, setgid, and sticky bits

Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems typically employ three additional modes. These are actually attributes but are referred to as permissions or modes. These special modes are for a file or directory overall, not by a class, though in the symbolic notation (see below) the setuid bit is set in the triad for the user, the setgid bit is set in the triad for the group and the sticky bit is set in the triad for others. * The '' set user ID'', ''setuid'', or SUID mode. When a file with setuid is executed, the resulting process will assume the effective
user ID Unix-like operating systems identify a user by a value called a user identifier, often abbreviated to user ID or UID. The UID, along with the group identifier (GID) and other access control criteria, is used to determine which system resources a us ...
given to the owner class. This enables users to be treated temporarily as root (or another user). * The '' set group ID'', ''setgid'', or SGID permission. When a file with ''setgid'' is executed, the resulting process will assume the
group ID In Unix-like systems, multiple users can be put into ''groups''. POSIX and conventional Unix file system permissions are organized into three classes, ''user'', ''group'', and ''others''. The use of groups allows additional abilities to be delega ...
given to the group class. When setgid is applied to a directory, new files and directories created under that directory will inherit their group from that directory. (Default behaviour is to use the primary group of the effective user when setting the group of new files and directories, except on BSD-derived systems which behave as though the setgid bit is always set on all directories (see
Setuid The Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Rit ...
).) * The ''
sticky Sticky may refer to: People *Sticky (musician), alias of UK garage producer Richard Forbes * Sticky Fingaz or Sticky (born 1973), nickname of the US rapper and actor Kirk Jones Adhesion *Adhesion Adhesion is the tendency of dissimilar ...
'' mode (also known as the ''Text'' mode). The classical behaviour of the sticky bit on executable files has been to encourage the
kernel Kernel may refer to: Computing * Kernel (operating system), the central component of most operating systems * Kernel (image processing), a matrix used for image convolution * Compute kernel, in GPGPU programming * Kernel method, in machine learnin ...
to retain the resulting process image in memory beyond termination; however, such use of the sticky bit is now restricted to only a minority of unix-like operating systems (
HP-UX HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrity Ser ...
and UnixWare). On a directory, the sticky permission prevents users from renaming, moving or deleting contained files owned by users other than themselves, even if they have write permission to the directory. Only the directory owner and superuser are exempt from this. These additional modes are also referred to as ''setuid bit'', ''setgid bit'', and ''sticky bit'', due to the fact that they each occupy only one bit.


Notation of traditional Unix permissions


Symbolic notation

Unix permissions are represented either in symbolic notation or in octal notation. The most common form, as used by the command ls -l, is symbolic notation. The first character of the ls display indicates the
file type A file format is a Computer standard, standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary format, pr ...
and is not related to permissions. The remaining nine characters are in three sets, each representing a class of permissions as three characters. The first set represents the ''user'' class. The second set represents the ''group'' class. The third set represents the ''others'' class. Each of the three characters represent the read, write, and execute permissions: * r if reading is permitted, - if it is not. * w if writing is permitted, - if it is not. * x if execution is permitted, - if it is not. The following are some examples of symbolic notation: * -rwxr-xr-x: a regular file whose user class has full permissions and whose group and others classes have only the read and execute permissions. * crw-rw-r--: a character special file whose user and group classes have the read and write permissions and whose others class has only the read permission. * dr-x------: a directory whose user class has read and execute permissions and whose group and others classes have no permissions. In some permission systems additional symbols in the ls -l display represent additional permission features: * + (plus) suffix indicates an access control list that can control additional permissions. * . (dot) suffix indicates an
SELinux Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for supporting access control security policies, including mandatory access controls (MAC). SELinux is a set of kernel modifications and user-space t ...
context is present. Details may be listed with the command ls -Z. * @ suffix indicates
extended file attributes Extended file attributes are file system features that enable users to associate computer files with metadata not interpreted by the filesystem, whereas regular attributes have a purpose strictly defined by the filesystem (such as permissions or re ...
are present. To represent the ''
setuid The Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Rit ...
'', ''
setgid The Unix access rights flags setuid and setgid (short for ''set user identity'' and ''set group identity'') allow users to run an executable with the file system permissions of the executable's owner or group respectively and to change behaviour ...
'' and '' sticky or text'' attributes, the executable character (x or -) is modified. Though these attributes affect the overall file, not only users in one class, the setuid attribute modifies the executable character in the triad for the user, the setgid attribute modifies the executable character in the triad for the group and the sticky or text attribute modifies the executable character in the triad for others. For the setuid or setgid attributes, in the first or second triad, the x becomes s and the - becomes S. For the sticky or text attribute, in the third triad, the x becomes t and the - becomes T. Here is an example: * -rwsr-Sr-t: a file whose user class has read, write and execute permissions; whose group class has read permission; whose others class has read and execute permissions; and which has ''
setuid The Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Rit ...
'', ''
setgid The Unix access rights flags setuid and setgid (short for ''set user identity'' and ''set group identity'') allow users to run an executable with the file system permissions of the executable's owner or group respectively and to change behaviour ...
'' and ''
sticky Sticky may refer to: People *Sticky (musician), alias of UK garage producer Richard Forbes * Sticky Fingaz or Sticky (born 1973), nickname of the US rapper and actor Kirk Jones Adhesion *Adhesion Adhesion is the tendency of dissimilar ...
'' attributes set.


Numeric notation

Another method for representing Unix permissions is an
octal The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
(base-8) notation as shown by stat -c %a. This notation consists of at least three digits. Each of the three rightmost digits represents a different component of the permissions: owner, group, and others. (If a fourth digit is present, the leftmost (high-order) digit addresses three additional attributes, the '' setuid bit'', the '' setgid bit'' and the ''
sticky bit In computing, the sticky bit is a user ownership File system permissions, access right Flag (computing), flag that can be assigned to Computer file, files and Directory (computing), directories on Unix-like systems. There are two definitions: one ...
''.) Each of these digits is the sum of its component bits in the
binary numeral system A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1" ( one). The base-2 numeral system is a positional notatio ...
. As a result, specific bits add to the sum as it is represented by a numeral: * The read bit adds 4 to its total (in binary 100), * The write bit adds 2 to its total (in binary 010), and * The execute bit adds 1 to its total (in binary 001). These values never produce ambiguous combinations; each sum represents a specific set of permissions. More technically, this is an octal representation of a
bit field A bit field is a data structure that consists of one or more adjacent bits which have been allocated for specific purposes, so that any single bit or group of bits within the structure can be set or inspected. A bit field is most commonly used to r ...
– each bit references a separate permission, and grouping 3 bits at a time in octal corresponds to grouping these permissions by user, group, and others. These are the examples from the symbolic notation section given in octal notation:


User private group

Some systems diverge from the traditional POSIX model of users and groups by creating a new group – a "user private group" – for each user. Assuming that each user is the only member of its user private group, this scheme allows an umask of 002 to be used without allowing other users to write to newly created files in normal directories because such files are assigned to the creating user's private group. However, when sharing files is desirable, the administrator can create a group containing the desired users, create a group-writable directory assigned to the new group, and, most importantly, make the directory setgid. Making it setgid will cause files created in it to be assigned to the same group as the directory and the 002 umask (enabled by using user private groups) will ensure that other members of the group will be able to write to those files.


See also

* Comparison_of_file_systems#Metadata *
chmod In Unix and Unix-like operating systems, is the command (computing), command and system call used to change the File-system permissions, access permissions and the #Special modes, special mode flags (the setuid, ''setuid'', ''setgid'', and stick ...
: change mode (permissions) on Unix-like file systems *
chattr is the command in Linux that allows a user to set certain attributes of a file. is the command that displays the attributes of a file. Most BSD-like systems, including macOS, have always had an analogous command to set the attributes, but no ...
or chflags: change attributes or flags including those which restrict access. * lsattr list attributes *
POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
*
umask In computing, umask is a command (computing), command that determines the settings of a Mask (computing), mask that controls how file permissions are set for newly created files. It may also affect how the file permissions are changed explicitly. ...
*
User identifier (Unix) Unix-like operating systems identify a user by a value called a user identifier, often abbreviated to user ID or UID. The UID, along with the group identifier (GID) and other access control criteria, is used to determine which system resources a us ...
*
Group identifier (Unix) In Unix-like systems, multiple users can be put into ''groups''. POSIX and conventional Unix file system permissions are organized into three classes, ''user'', ''group'', and ''others''. The use of groups allows additional abilities to be delega ...


References


External links


The Linux Cookbook: Groups and How to Work in Them
by Michael Stutz 2004 {{DEFAULTSORT:Filesystem permissions