Ubuntu and Linux command resolution for permission modification

  • 2020-05-12 06:45:48
  • OfStack

chmod change file permissions command

The most common base command is chmod

chmod 777 directory name (pathname)

The three digits of 777 represent the permissions of user, group and others respectively. The permissions of readable (r), writable (w) and executable (x) are represented by the Numbers 4, 2 and 1 respectively. The number 7 is the sum of permissions 4, 2 and 1.

You can view the current directory with ls-l

Ex. :

-rwxr--r- Sep 06 09:23 CO_00Z02AUG2016_dongbei.jpg

Add flags to perform more property operations

Example: chmod 777-R directory name

Flags (note: please do not ignore case, the linux system is case sensitive)

-f

Disables all error reporting (except for invalid permissions and usage statements).

-h

Disables changes to the way a symbolic link is encountered to a file or directory.

Note: this behavior is slightly different from the behavior of the -h flag on the chgrp and chown commands because you cannot set mode bits on symbolic links.

-R

Recursively descending directories only, as in pattern File... | Directory... Specified. -R flag changes the file mode bits for each directory and all files that match the specified pattern.

This is just a description of the basic usage of chmod. If you are interested in further study, please refer to other secrets and patterns of chmod


Related articles: