Using the command terminal in linux can be very frustrating if you can’t recollect all your commands,but worry no more chmod is here to help ease out some stress. So what is CHMOD ? CHMOD means ‘change mode’ and it changes file or directory mode bits (the way a file can be accessed). You can use chmod in the command line to change file or directory permissions on unix or unix-like systems such as linux or BSD. The users in chmod can be categorized into 3 groups namely:
- User, meaning the user who owns the file
- Group, meaning the files defined ownership group
- Other, meaning everyone else
and these 3 groups can be given different types of access to the files or directories
- Read (r), meaning the ability to look at the contents of a file
- Write (w), meaning the ability to change the contents of a file
- Execute (x), meaning the ability to run the contents of a file
You can extend chmod permissions with options.
Most popular options are:
- -r for ‘recursive’, include same mode in subdirectories
- -f for ‘force’, forge ahead with all objects even if errors occur
- -v for ‘verbose’, show objects processed
This can be very complicating so just save time and use chmodcommand
Chmod special modes
Setuid and setgid
Setuid and setgid (short for ‘set user ID upon execution’ and ‘set group ID upon execution’, respectively) are Unix access rights flags that allow users to run an executable with the permissions of the executable’s owner or group respectively and to change behaviour in directories. They are often used to allow users on a computer system to run programs with temporarily elevated privileges in order to perform a specific task. While the assumed user id or group id privileges provided are not always elevated, at a minimum they are specific.
Setuid for a directory
The setuid permission set on a directory is ignored on UNIX and Linux systems.
Setgid for a directory
Setting the setgid permission on a directory (‘chmod g+s’) causes new files and subdirectories created within it to inherit its group ID, rather than the primary group ID of the user who created the file (the owner ID is never affected, only the group ID). Newly created subdirectories inherit the setgid bit. Thus, this enables a shared workspace for a group without the inconvenience of requiring group members to explicitly change their current group before creating new files or directories. Note that setting the setgid permission on a directory only affects the group ID of new files and subdirectories created after the setgid bit is set, and is not applied to existing entities.
All these commands can be done with chmod .
Having trouble with your file and directory permissions ? just head to https://chmodcommand.com/ and ease your worries.