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
# Adding User to the sudo Group
usermod -aG sudo usernameSetUID
SUIDLet user execute a file with the permissions of the file’s owner.
sudo chmod 4755 mycat
sudo chmod u+s mycatPermission Leak
Use a leaked fd (with permission when opened) and forget to close(fd)