Set permissions for directories and files under Linux
When you set permissions on files and directories, you first need to know what the three digits of the Liunx permission mode mean.
Example 777 this three number, the first one represents the owner group others all the permissions. Owner-owned permissions, permissions owned by group users, and permissions owned by other users.
In Linux permissions 1=x Execute permissions 2=w Write permissions 3=r read the permission to see the above three data respectively is 7, 7, 7 this 7=1+2+3 represents have to execute, write, read three kinds of permissions. To join us to three roles is only execute, write permission, then this number should be 333 because 3=1 +2 performs the Write permission.
Let's take a look at the command statement that changes the file permissions Chmod 777 File|dir-r This later parameter we can view all the files in the directory by the LL command with the permissions of the three roles.
The-r parameter recursively changes the genus of the specified directory and all subdirectories and files under it.
Permissions can be changed by means of a digital grant when granting permissions. You can also change permissions by using text-giving methods.
1 Digital settings
Mode refer to the above three numbers name file name
# chmod Mode Name
You can view the permissions of a file by command #ls-l
2 text Settings
Command format: # chmod [who] [+ | –| =] [mode] filename?
Use text to set permissions need to understand U (file owner) g (file user group) O (Other user) a (all users)
Need to understand X (Execute permission), W (Write permission), R (Read permission)
The operation symbols can be:
+ Add a permission.
-Cancels a permission.
= gives the given permission and cancels all other permissions, if any.
Linux common commands (2)