I present to you a collection of the most useful Linux commands regarding Permissions and special attributes
File and folder permissions
Show permissions
To view the permissions of files and directories in a readable format.
ls -lh
Assign 0777 permissions to a file
Allows read, write, and execute for everyone.
chmod 0777 file
Modify permissions of a directory
Assigns read and write permissions to all files within a directory.
chmod -R 0644 directory
Set permissions on a directory
Add or remove read (r), write (w), and execute (x) permissions for the owner (u), group (g), and others (o).
chmod ugo+rwx directory
Change owner of a file
Changes the owner of a specific file.
chown user file
Change owner for all files in a directory
Applies the ownership change to all files in a directory.
chown -R user directory
Change group of a file
Modifies the group of a file.
chgrp group file
Change user and group of a file
Sets both the owner and the group for a file.
chown user:group file
SUID permissions
View files with SUID
Shows all system files that have the SUID bit set.
find / -perm -u+s
Set SUID bit on a binary file
Allows the user executing this file to have the same privileges as the owner.
chmod u+s /bin/file
Remove SUID bit from a binary file
Removes the SUID bit from a file.
chmod u-s /bin/file
Set SGID bit on a directory
Assigns the SGID bit to a directory, similar to SUID, but for directories.
chmod g+s /home/directory
Remove SGID bit from a directory
Removes the SGID bit from a directory.
chmod g-s /home/directory
Set STICKY bit on a directory
Allows the deletion of files only by their rightful owners.
chmod o+t /home/directory
Remove STICKY bit from a directory
Removes the STICKY bit from a directory.
chmod o-t /home/directory