User and Rights management
I. Basic overview
Linux is a multi-user, multi-tasking operating system, in the production environment in the operation and maintenance departments have a variety of operations operators, system users, so many people may often use this host to work at the same time, in order to consider everyone's preferred work environment, therefore, this "user" 's role is very important. In order for each user to better manage the file and keep the file data confidential, it becomes important to be familiar with the file's read, write, execute attributes and rights management. Linux generally divides the identity of files accessible access into 3 categories, namely owner,group, Other, and 3 of the identities have read, write, execute and other permissions. under Linux so many directories, files, in the end each directory, file represents what meaning? Here's how to answer this.
Two: Application Scenarios and meanings
1. Understanding the properties of Linux files
2. Changing file attributes and Permissions
3. Managing File Data Security
4. Team operations Development, collaboration, or data sharing applications
Three: actual operation
Understanding of a.linux file attributes
1. After logging into Linux as root , execute "ls-al" To view the directory file, you will see the following content 650) this.width=650; "src=" http:/ S4.51cto.com/wyfs02/m01/77/c1/wkiom1ztfbig9gl9aacozfjti-i712.jpg "title=" 2316184_1_o.jpg "alt=" Wkiom1ztfbig9gl9aacozfjti-i712.jpg "/>
A. The first column represents the type and permissions of this file
L if [d] is the directory
L if [-] is the file
L if [l] is indicated as a linked file
L if [b] indicates a storage-ready interface device in the device file
L if [c] indicates the serial port device inside the device file
LIn the next string, to3A group, and all are "rwx"of3a combination of parameters, whereRdelegates are readable,Wrepresentative can write,xrepresents an executable. Note: this3the location of the permissions will not change, if there is no permission, it will appear[-] only.
L The first group is "Permissions for file owners"
L The second group is "permissions for the same user group"
L The third group is "permissions for other non-user groups"
B. The second column indicates how many file names are connected to this node
C. The third column represents the "owner account" of this file
D. Column Fourth indicates the user group to which this file belongs
F. Sixth column the date of creation of this file or the date of the most recent modification
G. seventh column The file name: If the file name is preceded by a ".", then it represents "hidden file".
Second, change the file attributes and permissions
lchgrp: Change the user group to which the file belongs
L chown: Changing the file owner
lchmod: Change permissions on files
▲ Change the owning user group:chgrp
~] #chgrp [-R] Dirname/filename
Options and Parameters
-R: continuous changes to the recursive, that is, together with all the files and directories under the subdirectory are updated to the meaning of this user group, often used to change all the files in a directory situation.
Example:
Chgrp-r Users Instal.log
Note: The group name to be changed must exist within the/etc/group file, otherwise an error will be displayed.
▲ Change the file owner: Chown
~] #chown [-r] account name file or directory
Parameters:
-R: Continuous change of recursion, i.e. all files under subdirectories are changed
Chown can also use "Chown user:group file" while changing the owner and user group
Example:1. Change the owner of the Install.log to the bin account
~] #chown Bin Install.log
2. Change the install.log owner and user group back to root
~] #chown root:root Install.log
Note: The user must be an account that already exists in the system, that is, the user name that is logged in the /etc/passwd file can be changed.
▲ Change Permissions: chmod
The number type changes file permissions 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M00/77/C0/wKioL1ZtfnuyiM_sAAGjka1-EeA719.jpg " Title= "1349109563391492298 (1). jpg" alt= "wkiol1ztfnuyim_saagjka1-eea719.jpg"/>
The three permissions (R,w,x) for each identity (owner,Group,others) are cumulative, for example:
Owner:rwx=4+2+1=7
Group:rw-=4+2+0=6
Others:---=0+0+0=0
chmod Modify Permission Syntax:
~] #chmod [-r] XYZ file or directory
Parameters:
XYZ: is the permission attribute of the number type just mentioned, which is the sum of the numeric values of the rwx property.
-R: Continuous change of recursion, that is, all files under subdirectories will change
Example: Set the . BASHRC All permissions on this file to Enabled.
~]# chmod 777. BASHRC
Symbol Type change file right Limit
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/77/C0/wKioL1ZtfqWx_jfXAABa0GV2_jU152.jpg "title=" u= 3765894785,4228198314&fm=15&gp=0.jpg "alt=" Wkiol1ztfqwx_jfxaaba0gv2_ju152.jpg "/>
Example:~] #chmod u=rwx,go=rx. BASHRC
~] #chmod a+w. BASHRC
~] #chmod a-w. BASHRC
Third, directory and the meaning of the file permissions
File: R: Can get the data of the file
W: can modify the data of the file
X: This file can be run as a process
Catalog: R: You can use the ls command to get a list of all the files under it
W: Can modify the list of files in this directory, that is, create or delete files
X: Can be CD master in this directory, and you can use ls-l to get detailed property information for all files
This article from "lkm" blog, reproduced please contact the author!
User and Rights Management