Skip to main content

Understanding Linux Permission Attributes

Decoding Permission Attributes: A Detailed Table

Here's a table to help you understand various combinations of permission attributes, starting from simple to more complex:

Permission AttributeTypeOwner PermissionsGroup PermissionsEverybody PermissionsDescription
-rw-------FilerwOnly the owner can read and write the file. No other user can do anything with it.
drwx------DirectoryrwxOnly the owner can read, write, and execute (i.e., enter and list the directory).
-rw-r--r--FilerwrrThe owner can read and write the file. The group and others can only read it.
drwxr-xr-xDirectoryrwxrxrxThe owner has full permissions, whereas the group and others can read and execute (i.e., list and enter).
-rwxr-xr-xFilerwxrxrxThe owner can read, write, and execute the file. The group and others can read and execute.
lrwxrwxrwxLinkrwxrwxrwxThis is a symbolic link, and all users have read, write, and execute permissions.
-rw-r-----FilerwrThe owner can read and write, the group can read, and others have no permission.
drwxrwx---DirectoryrwxrwxThe owner and the group have full permissions, but others cannot access the directory at all.
-rwxr-x---FilerwxrxThe owner can read, write, and execute, whereas the group can only read and execute the file.
crw-rw----Char DevrwrwCharacter device file with read and write permission for owner and group only.
brw-r-----Block DevrwrBlock device file with read and write permission for owner and read for the group.
-rwsr-xr-xFilerwsrxrxThe owner has SUID bit set, meaning the commands run as the owner and not the invoker.
drwxrwsr-xDirectoryrwxrwsrxThe owner and group have full permissions. The 's' signifies that the SGID bit is set.
drwxr-xr-tDirectoryrwxrxrtThe 't' is the sticky bit, which means only the file's owner or root can delete or modify the files.

Legend

  • Type: d (Directory), - (File), l (Link), c (Character Device), b (Block Device)
  • Permissions: r (Read), w (Write), x (Execute), s (SetUID or SetGID), t (Sticky Bit)

How to Read These Attributes

Reading these attributes is straightforward once you understand the order:

  1. First Character: Identifies the type (d for directories, - for regular files, l for symbolic links, c for character devices, b for block devices).

  2. Next 9 Characters: Split into three triads, each representing read (r), write (w), and execute (x) permissions for the owner, the group, and others, respectively.

  3. Special Flags: s and t are special permissions. s stands for " SetUID" or "SetGID," while t is the "Sticky Bit."

By understanding this table and the composition of permission attributes, you can better navigate the Linux filesystem, set appropriate permissions, and enhance the security of your system.

What Can You Do Next 🙏😊

If you liked the article, consider subscribing to Cloudaffle, my YouTube Channel, where I keep posting in-depth tutorials and all edutainment stuff for software developers.

YouTube @cloudaffle