Change Mod (chmod) command in Linux OS
- Steven Belanger
- Oct 23, 2021
- 1 min read
The chmod, or change mode, is the command used to change the mode (permissions) of files or directories. Using the chmod requires at least 2 arguments, criteria used to change permissions and file names that need to be changed. The categories used: u (user), g (group), o (other), and a (all categories). There are 3 operations used in chmod: +, the addition sign signals the operation to add a permission; -, the negative sign signals the operation to remove a permission; and =, the equal sign signals the operation to make a permission equal to ______. There are also 3 different permission used in chmods. These are: r (read), w (write), and x (execute). When used for a directory:
The read permission grants permission to read the names of files, but does not grant access to the information in the file.
Execute will grant the ability to search and grants the ability to access file contents and meta-information assuming its name is known. It does not list the contents of files inside however.
Write grants the ability to modify entries (execute must also be active).
When used for a file
read permission grants the right to read the file and it's attributes.
Execute permission allows the file to be executed.
Write gives permission to modify a file. This will create a new file and will delete the old file after saving.
Examples:
chmod a-x publicComments.txt (removes execute permissions for all classes)
chmod a+rx viewer.sh (adds permissions to read and execute for all classes)
Sources:
More information gathered from Wikipedia (Links to an external site.)(click to be redirected to link) including the examples.
댓글