Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
File-system permissions
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Representation=== Permissions are commonly represented in symbolic or octal notation. ====Symbolic notation==== Symbolic notation is used in the long output format of command <code>ls -l</code>. The first character of the output indicates the [[Unix file type]] which is not a permission even though its next to the permissions information. The remaining nine characters represent the grants for the user, group and others classes as groups of operation grants for read, write and execute. An operation is denied when shown as a dash or granted when shown as {{code|r}} for read, {{code|w}} for write or {{code|x}} for execute. Examples: * <code>-rwxr-xr-x</code>: initial {{code|-}} indicates a regular file, next three {{code|rwx}} indicate that user class has all permissions and group and others classes (both {{code|r-x}}) have only read and execute * <code>crw-rw-r--</code>: initial {{code|c}} indicates a character special file, user and group classes (both {{code|rw-}}) have read and write permissions and others class ({{code|r--}}) has only read permission * <code>dr-x------</code>: initial {{code|d}}) indicates a directory, user class ({{code|r-x}}) has read and execute permissions and group and others classes (both {{code|---}}) have no permissions To represent the ''setuid'', ''setgid'' and ''sticky/text'' attributes, the character in the third position for a class is modified; even though this position is otherwise only for execute and even though these attributes affect the file without concern for class. The setuid attribute modifies the execute character for the user class, the setgid attribute modifies the execute character for the group class, and the sticky or text attribute modifies the execute character for the others class. For setuid or setgid, <code>x</code> becomes <code>s</code> and <code>-</code> becomes <code>S</code>. For the sticky or text attribute <code>x</code> becomes <code>t</code> and <code>-</code> becomes <code>T</code>. For example <code>-rwsr-Sr-t</code> indicates a regular file, user class has read, write and execute permissions; group class has read permission; others class has read and execute permissions; and which has ''setuid'', ''setgid'' and ''sticky'' attributes set. Some systems show additional permission features: * {{code|+}} suffix indicates an access control list that can control additional permissions * {{code|.}} suffix indicates an [[SELinux]] context is present. Details may be listed with the command <code>ls -Z</code> * {{code|@}} suffix indicates [[extended file attributes]] are present ====Octal notation==== Permissions are often shown in [[octal]] notation; for example via the command <code>stat -c %a</code>. The notation consists of at least three digits. The last three digits represent the permission by class: user, group, and others. If a fourth digit is present, the leftmost represents the three special attributes: ''setuid'', ''setgid'' and ''sticky''. Each operation grant is assigned a bit position that for an octal digit is: * Read: left, binary 100, octal 4 * Write: middle, binary 010, octal 2 * Execute: right, binary 001, octal 1 A class permission value is the sum or alternatively the [[Logical disjunction|logic OR]] of the grants. Examples: {| class="wikitable" style="text-align: center;" |- ! Symbolic !! Octal !! Description |- | style="text-align: center;" | <code>----------</code> || 0000 || style="text-align: left" | no permissions |- | style="text-align: center;" | <code>-rwx------</code> ||0700|| style="text-align: left" | read, write, & execute only for owner |- | style="text-align: center;" | <code>-rwxrwx---</code> || 0770 || style="text-align: left" | read, write, & execute for owner and group |- | style="text-align: center;" | <code>-rwxrwxrwx</code> || 0777 || style="text-align: left" | read, write, & execute for owner, group and others |- | style="text-align: center;" | <code>-rwxr-----</code> || 0740 || style="text-align: left" | owner can read, write, & execute; group can only read; others have no permissions |- |} <!-- Here is a list of the meanings for individual octal digit values: 0 --- no permission 1 --x execute 2 -w- write 3 -wx write and execute 4 r-- read 5 r-x read and execute 6 rw- read and write 7 rwx read, write, and execute Here some example showing which digits affect permissions for user, group, and other: * 754 = <code>"-rwxr-xr--"</code> = rwx for owner, r-x for group, r-- for other * 124 = <code>"---x-w-r--"</code> = x for owner, w for group, r for other no permissions at all! ===Numeric notation and additional permissions=== There is also a ''four-digit'' form of numeric notation. In this scheme, the standard three digits described above become the last three digits. The first digit represents the additional permissions. On some systems, this first digit cannot be omitted; it is therefore common to use all four digits (where the first digit is zero). This first digit is also the sum of component bits: * The setuid bit adds 4 to the total, * The setgid bit adds 2 to the total, and * The sticky bit adds 1 to the total. The example from the ''Symbolic notation and additional permissions'' section, <code>"-rwsr-Sr-x"</code> would be represented as <code>6745</code> in four-digit octal. In addition, the examples in the previous section (<code>755</code>, <code>664</code>, and <code>500</code>) would be represented as <code>0755</code>, <code>0664</code>, and <code>0500</code> respectively in four-digit octal notation. -->
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)