Symbolic permission modes in Unix and Linux systems provide a way to set file and directory permissions using letters instead of numbers. The symbolic mode uses the following components:
Permission Types
- r: Read permission
- w: Write permission
- x: Execute permission
User Classes
- u: User (owner of the file)
- g: Group (users who are members of the file's group)
- o: Others (all other users)
- a: All (user, group, and others)
Operators
- +: Adds a permission
- -: Removes a permission
- =: Sets the permission and overrides existing permissions
Examples
-
Add Execute Permission for the User:
chmod u+x filenameThis command adds execute permission for the owner of the file.
-
Remove Write Permission for the Group:
chmod g-w filenameThis command removes write permission for the group.
-
Set Read and Write Permissions for Others:
chmod o=rw filenameThis command sets read and write permissions for others, removing any existing permissions.
-
Add Read Permission for All:
chmod a+r filenameThis command adds read permission for the user, group, and others.
Using symbolic modes allows for more granular control over permissions and can be easier to read and understand compared to numeric modes.
