The Rights management under Linux is inseparable from the concept of user and group. In short, the files under Linux have three permissions R W x
For a file,
R: Readable, you can use similar commands such as cat to view the contents of the file;
W: writable, can edit or delete this file;
X: Executable, exacutable, can be at the command prompt as a command to submit to the kernel to run;
For catalogs:
R: You can perform LS on this directory to list all internal files
W: Files can be created in this directory;
X: You can switch to this directory using a CD, or you can use Ls-l to view the details of the internal files;
For files or directories, permissions according to the owner of the file can be divided into three groups, the file (the directory is actually a file, is a file path mapping), belong to the group, others, through the ls-l file_name can be viewed. The list of permissions, such as Bin, is r-xr-xr-x
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/84/20/wKiom1eGA26BSBm6AAOChanLE94725.jpg-wh_500x0-wm_3 -wmp_4-s_2062060457.jpg "title=" quanxian.jpg "alt=" Wkiom1ega26bsbm6aaochanle94725.jpg-wh_50 "/>
You can use a group of permissions rwx (if a permission exists, the bit is 1, otherwise 0, for example, RWX is 111,r_x to 101), the decimal number represented by the binary number represents the right to reorganize.
Example: rwxrwxrwx 777
Rw_rw_rw_ 666
Whether a user has permission to manipulate a file or directory is by comparing the permissions that the user has with the file to the list of permissions that the file has.
There are two types of users under the Linux system,
1. For general users, this type of user ID number is 500-60000, this user can use the system resources after logging on to the system.
2. System user, this kind of user ID number is 1-499 this kind of user is specially used to run certain kind of service, is not allow the user to log in. such as Bin
And groups can be divided into three categories,
Private group: When a user is created, a group that has the same name as the user name is automatically created for it if no group is specified for it, and the group contains only that user.
Basic group: User's default group, user-created file is the default genus group
Additional groups, additional groups: groups other than the default group
So how do you manage users and groups?
Commands for managing users and groups under Linux are mainly Useradd userdel usermod groupadd groupdel ID finger passwd
1. Add Users.
useradd [Options] USERNAME
-U UID
-G GID (Basic Group) group number or the name of the group
-G GID,... (Additional groups)
-C "COMMENT"
-d/path/to/directory
-S SHELL
-M-K Specifies the skeleton directory (default is/etc/skel if not specified) when you create a user home directory, copy the files from that directory to the user's home directory
-M do not create home directory
-R: Adding system users
2. Modify the user
Usermod
-U UID
-G GID
-a-g GID: Do not use the-a option, will overwrite the previous additional group;
-C Modify User's comment information
-d-m: Modify the user's home directory and move information from the home directory to the new home directory
-S Modified login Shell
-L New User name
-L: Lock account
-U: Unlock Account
3. Delete a user
Userdel:
Userdel [option] USERNAME
-r: Delete User's home directory at the same time
4. View user's account information
ID [Options] USERNAME
-U Print User ID
-G Print the base group ID
-G print ID for all groups
-N Prints the name instead of the ID
5.finger USERNAME
View user's account information
6. Password Management passwd
passwd [USERNAME]
--stdin Password Change password read from standard input
echo 123456 | passwd Joedut--stdin
-L Lock Account
-U Unlock Account
-D: Remove user password
-N Minimum Password usage period
-X Password maximum age
7. Create a group
Groupadd
-G GID
-R: Added as System group
8. Delete a group
Groupdel group_name
This article is from the "thick Product Thin Hair" blog, please make sure to keep this source http://joedlut.blog.51cto.com/6570198/1826150
Linux Basics (5) Linux users, group management and Linux permissions on the next