Common operations for Linux file permissions

2022-06-16 0 By

Linux File permissions You can set permissions for Linux files for different users. The administrator (root) has all permissions.File Permission Description Command to view all files in the path: ll or ls -l The query result lists the files and folders in the current path. Each line of data is displayed in the same format.The first character is of two common types, d and -, d for folder and – for file.There is also l for links, soft links are more common, as shown in the figure: starting with the second character, groups of three.Use r, w, x, and -, in the order of RWX, each letter represents a permission.R: read permission W: file can be edited x: execute permission – : no permission The file contains nine characters and is divided into three groups, indicating the user permission, user group permission, and other user permissions of the file.Chmod Permission modification Method 1 The permission identifier is divided into three groups, namely, the permission of the file owning user, the permission of the user owning group, and the permission of other users. The three groups are replaced by u, G, and O respectively, namely, user, group, and others.File1chmod u= RWX file1chmod u= RWX, g= rw-file1chmod Add group identifier and permission, directly modify file permissions.Chmod Modify permission Method Two numbers represent the permission.R =4,w=2,x=1,-=0 add up to 7.All possible permissions are not duplicated: RWX =7,-wx=3,r-x=5,rw-=6 Three groups of permissions are represented by three digits chmod 777 file1chmod 764 file2chmod Recursive folder The -r parameter is required to change folder permissions.Chmod -r 777 ABC indicates the permission to recursively modify subfiles