Numeric Values of permissions in Linux

2023-06-15

File Permission Modes The chmod command enables you to change the permissions on a file. You must be superuser or the owner of a file or directory to change its permissions.You can use the chmod command to set permissions in either of two modes:
Absolute Mode – Use numbers to represent file permissions. When you change permissions by using the absolute mode, you represent permissions for each triplet by an octal mode number. Absolute mode is the method most commonly used to set permissions.
Symbolic Mode – Use combinations of letters and symbols to add permissions or remove permissions.
The value of read permisson is 4,write is 2 and value of execution is 1 that means,
rw- is 4+2=6
r-x is 4+1=5
-wx is 2+1=3
rwx is 4+2+1=7
r-- is 4
--x is 1
-w- is 2
The default permission is 6. 666 first digit to the user,second to the group, third to others. you can change the default permission values with the help of umask. open up terminal and enter umask to find the default permission and to change it enter umask then the numeric value of permissions.
Try this:
Create a file with permission values 411.
Not only rwx linux also has some other important file permissions they are
1) SUID
2) SGID
3) Sticky Bit.
*SUID can be enabled on any executable file it will provide owner permission to anyone,called as priviledge.
[light@kali ~]$ ls -l /usr/bin/passwd
-rwsr-xr-x. 1 root root 33544 Dec 13 2019 /usr/bin/passwd
*group + s (pecial)
Commonly noted as SGID, this special permission has a couple of functions:
If set on a file, it allows the file to be executed as the group that owns the file (similar to SUID) If set on a directory, any files created in the directory will have their group ownership set to that of the directory owner
*StickyNote
+ t (sticky)
The last special permission has been dubbed the "sticky bit." This permission does not affect individual files. However, at the directory level, it restricts file deletion. Only the owner (and root) of a file can remove the file within that directory. A common example of this is the /tmp directory:

.
.
.
L