Linux FAQ 1: permission denied

Time:2020-3-25

① , when accessing the file: permission denied

Reason:File or folder access denied

resolvent:

Sudo Chmod – R 777 pathfilename

Use administrator privileges to add read, write, and execute privileges for all users for files denied access

-R or — recursive: recursive processing, processing all files and subdirectories under the instruction directory together;

 

extend

Jurisdiction scope
u: User is the owner of the file or directory;
g: Group refers to the group of files or directories;
o: Other, except for the owner or group of the file or directory, other users belong to this range;
a: All, that is, all users, including the owner, the group and other users;

r: Read permission, the number code is “4”;
w: Write permission, number code is “2”;
x: Execute or switch the authority, and the number code is “1”;
-: without any permission, the number code is “0”;
s: Special function description: change the permission of file or directory.
  

Chmod command

Function: used to change the permissions of a file or directory. The permission of symbolic connection cannot be changed. If the user modifies the permission of symbolic connection, the change will affect the connected original file.
Syntax: Chmod options permission mode document
option
– C or – changes: the effect is similar to the “- V” parameter, but only the changed part is returned;
– f or — quiet or — silent: no error message is displayed;
– R or – recursive: recursive processing, processing all files and subdirectories under the instruction directory together;
– V or – verbose: display the instruction execution process;
— Reference =: set the group of the specified file or directory to be the same as the group of the reference file or directory;
+: enable the option permission setting of the file or directory with permission range;
-: close the permission setting of this option for files or directories within the permission range;
=: this option permission setting of the file or directory with specified permission range;
parameter
Permission mode: Specifies the permission mode of the file;
File: the file for which you want to change permissions.
case
CHMOD U + X, G + W file name / / set the permissions that you can execute and the members can write to the file
Chmod u = RWX, g = RW, o = R filename
Chmod 764 filename

Chmod a + X filename / / set the executable properties for u, G, O of the file
Chmod a = x filename / / set the executable properties for u, G, O of the file
Chmod + X filename / / set the executable properties for u, G, O of the file