How to use chmod in linux
- user (u),
- group (g),
- other (o)
- all (a)
The permission
- r for read,
- w for write and
- x for execute
For example: Change mode a file as below, that group has not write, execute permission, the other is too
chmod go-wx filename
Example 1: The file should have read, write and execute permissions to user, read and execute permissions to group and read, and execute permissions to others.
read, write and execute permissions to user =7
read and execute permissions to group =5
read and execute permissions to others=5
So total permissions will be 755
chmod 755 filename
Example 2: Providing write access to a user
chmod u+w filename
Example 3: Adding write permissions to a group
chmod g+w filename
Example 4: Adding executable permissions to others
chmod o+x filename
Example 5: Adding executable and write permissions to all
chmod a+wx filename
Example 6: Replicating user permissions to a group
chmod u=g filename
Example 7: Removing execute permissions to a user
Chmod u-x filename
Example 8: Adding execute permissions to others
Chmod o+x
Ref: https://www.linuxnix.com/chmod-command-explained-linuxunix/
Comments
Post a Comment