There are three types of permissions for accessing linux/UNIX files:
Permission Regular file access permission Directory access permission R Has the right to read the file Can read the file name W Has the right to write to the file Can create and delete files, can change file names X Has the right to execute the file Can use files in the directory (e.g. cd command), search for files, etc.
Types of users who can access files There are three types of users who can access files:
User Type Description owner Owner of the file group Members within the user group other Other users (non-owner and non-group)
Each type of user has three file access permissions: r, w, x.
Display of file access permissions It can be displayed using the "ls -l" command, for example:
$ ls -l test
Displays as:
-rwxr-xr-- 2?test?test 321?Jan 00:00:00?test
In the above line: Characters 2-4 "rwx" indicate that the owner "test" has the rights to the file "test" as "readable, writable, executable"; Characters 5-7 "r-x" indicate that users within the group "test" have the rights to the file "test" as "readable, not writable, executable"; Characters 8-10 "r--" indicate that other users have the rights to the file "test" as "readable, not writable, not executable"
700, 777 numbers represent linux/UNIX permissions The representation of permissions in linux/UNIX, as shown above, "rwx" is represented as the number 7. The permissions in linux/UNIX are represented using 8421 addition, assigning a certain weight to each permission. x = 4, w = 2, r = 1. The sum of the weights represents the user's permission. 7 = 1 + 2 + 4, which is rwx. 777 is rwx rwx rwx. 700 is rwx --- ---. 000 represents unset --- --- ---
Modifying file access permissions Use the chmod command to modify the file's access permissions.