A chmod is used to change permission of files and directories.
- form: chmod [options] permissions filename
permissions
can be represented in two ways.
- Alphabetic combination
- Numeric combination
Alphabetic combination
- User
- a: All people
- u: owner
- g: group
- o: others
- Permission
- r: read
- w: write
- x: execute
- Example:
- chmod u=rwx practice.txt : Owner gets all permissions on practice.txt.
- chmod g-w practice.txt : Group’s write permission on practice.txt is removed.
- chmod o+rx practice.txt : Others get additional read and execute permissions.
- chmod a=rwx practice.txt : All people get all permissions.
Numeric Combination
- Permission
- 4: read
- 2: write
- 1: execute
- Example:
- chmod 755 practice.txt : owner gets all permission. Group and others get read and execute permission.
- chmod 777 practice.txt : All people get all the permissions.
options