Useradd testuser; Add user testuser to user name passwd testuser; Modify user password prompt two times enter password give root permission to modify the/etc/sudoers file, locate the following line, and add a row below root, as follows: # # allow ROOT to run any commands anywhereroot& nbsp; all= (All) ALLtestuser all= (All) ALL Root represents the authorized user, this is the root user, the first all represents all computers, the second all represents all users, and the third all represents all commands; the whole sentence means that the root user is authorized to run all files as all users on all computers. Example 1:useradd–d/usr/sam-m Sam This command creates a user Sam, where the-D and-m options are used to generate a home directory for the login Sam/usr/sam (/usr is the parent directory where the default user home directory resides). userdel Sam This command removes user Sam's records in System files (primarily/etc/passwd,/etc/shadow,/etc/group, etc.) while deleting the user's home directory.  USERMOD option Username//Modify existing user (1) Modify user directory First use the Finger Username command to view the user's original home directory if the following error occurred: Finger:command not found solution: Yum Install finger enter ID username to view user uidid username Modify user home directory usermod-d/usr/newfolder-u UID username-u must receive UID after , and then the username after the modification is complete, the finger username can be checked for changes before and after modification. There are two types in the centos group, private and Standard, and when a new user is created, without specifying the group to which he belongs, CentOS builds the same private group as the user, which only includes the user himself. A standard group can hold multiple users, and if you want to use a standard group, you should specify the group that he belongs to when you create a new user, and on the other hand, the same user canbelong to more than one group, such as the leadership group and Technical Group of a unit, Lik is the technical director of the Unit, so he belongs to the leadership group and the Technical Group. When a user belongs to more than one group, the group to which they are logged on is the primary group, and the other groups are additional groups. New group Groupadd WebUsers #新建一个webusers组删除组groupdel The initialization of the webusers useradd also includes creating a separate group for users with the same name as the user name ( Floatboat group). This is called the mechanism of the user private group, which corresponds to the default group mechanism. The user Group One is convenient for management, the second is to be able to clear permissions. Complex we will explore in the future in-depth content. If we want this user to join an existing group, you can use the-g parameter. For example, if we want TestUser to join the WebUsers group, you can use the following command: Useradd-g webusers testuser Similarly, we can also use the-G parameter to enable him to join multiple groups at the same time. such as WebUsers and Ftpusers:useradd-g ftpusers,webusers testuser
Linux User Management (CentOS)