Method of modifying file and folder permission by Chmod command in Linux

in Linux to modify a folder or file permissions, we need to use Linux chmod command to do, I wrote a few simple example below you can consult.
chmod [who] [+ |-| =] [mode] filename

u
u
u
u
u
u
u
u
u
u
u
g stands for “group user”, that is, all users with the same group ID as the file owner.
o stands for other (others) users.
a stands for “all” users. It is the system default. The
action symbol can be:
+ to add a permission.
– cancel a permission.
= grant the given permission and cancel all other permissions, if any.
the permissions represented by the setting mode can be any combination of the following letters:
r readable.
w can be written.
x executable. The
X attribute is appended only if the target file is executable for some users or if the target file is a directory.
s sets the process’s owner or group ID to the file’s owner at file execution time. Mode “U + S” to set the file user ID bit, “G +s” to set the group ID bit.
t saves the text of the program to the switching device.
u has the same permissions as the file owner.
g has the same permissions as the user in the same group as the file owner.
o has the same permissions as other users. Instance

modify attributes of the file read/write method, such as: the index. The HTML file is modified to write readable executable:

code below copy code chmod 777 index. HTML
directory to modify all write readable executable file attributes can be:

code below copy code chmod 777.
the folder name with the suffix to use * to instead of it.
such as: Modify the properties of all HTM files:
code copy code
chmod 777 *. HTM
method to modify folder properties
change directory /images/xiao to writable readable executable
code copy code
chmod 777 /images/xiao
modify all folder properties
code copy code
chmod 777 *
Just replace the folder name with *

to modify all files and folders in the folder and subfolder properties to be writable readable executable
code as follows copy code
chmod -r 777 /upload

summarizes the difference in permissions between directories and files under Linux.
files: read file contents (r), write data to file (w), execute file as command (x).
directory: read the files contained in the directory name (r), write information into the directory links (add and remove the index point), and search the directory (can use the directory name as a path name to access files and subdirectories) it contains specific said is:

(1) have read permissions users can’t use CD into the directory: also must have execute permission to enter.
(2) users with execute permission will only be able to access files in the directory if they know the file name and have read rights.
(3) you must have read and execute permissions to list directories ls, or use the CD command to enter directories.
(4) has write permissions to the directory and can create, delete, or modify any file or subdirectory under the directory, even if the file or subdirectory belongs to another user.

Read More: