File Permission
The permissions consist of three groupings: what the owner of the file can do to it, what someone in a group can do to the file, and finally, what anyone (sometimes referred to as other) can do.
chown
Change the owner of file.
user:group
chmod
Change file permission
chmod permissions filename
There are 2 ways to use the command –
- Absolute mode
- Symbolic mode
Use mask to get the result. Maximum is 111
, the left-most bit is read
, middle bit is write
, right-most bit is execute
.
- 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).
Sudo Group
SetUID
SUID
Let user execute a file with the permissions of the file’s owner.
Permission Leak
Use a leaked fd
(with permission when opened) and forget to close(fd)