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 Attribute | Type | Owner Permissions | Group Permissions | Everybody Permissions | Description |
---|---|---|---|---|---|
-rw------- | File | rw | Only the owner can read and write the file. No other user can do anything with it. | ||
drwx------ | Directory | rwx | Only the owner can read, write, and execute (i.e., enter and list the directory). | ||
-rw-r--r-- | File | rw | r | r | The owner can read and write the file. The group and others can only read it. |
drwxr-xr-x | Directory | rwx | rx | rx | The owner has full permissions, whereas the group and others can read and execute (i.e., list and enter). |
-rwxr-xr-x | File | rwx | rx | rx | The owner can read, write, and execute the file. The group and others can read and execute. |
lrwxrwxrwx | Link | rwx | rwx | rwx | This is a symbolic link, and all users have read, write, and execute permissions. |
-rw-r----- | File | rw | r | The owner can read and write, the group can read, and others have no permission. | |
drwxrwx--- | Directory | rwx | rwx | The owner and the group have full permissions, but others cannot access the directory at all. | |
-rwxr-x--- | File | rwx | rx | The owner can read, write, and execute, whereas the group can only read and execute the file. | |
crw-rw---- | Char Dev | rw | rw | Character device file with read and write permission for owner and group only. | |
brw-r----- | Block Dev | rw | r | Block device file with read and write permission for owner and read for the group. | |
-rwsr-xr-x | File | rws | rx | rx | The owner has SUID bit set, meaning the commands run as the owner and not the invoker. |
drwxrwsr-x | Directory | rwx | rws | rx | The owner and group have full permissions. The 's' signifies that the SGID bit is set. |
drwxr-xr-t | Directory | rwx | rx | rt | The '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:
First Character: Identifies the type (
d
for directories,-
for regular files,l
for symbolic links,c
for character devices,b
for block devices).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.Special Flags:
s
andt
are special permissions.s
stands for " SetUID" or "SetGID," whilet
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.