Account management commands useradd and groupadd: 1. master the user's Add/delete/modify command 2. master group addition, deletion, and modification Command Group Management. 1) groupaddgroupadd is used to add group accounts. The format is as follows: groupadd [-g GID] GROUP where: GROUP: is the name of the GROUP to be added-g: used to specify the GID. By default, add 1 with the largest GID. For example: add a new group leader # groupadd leader # grep leader/etc/groupleader: x: 504: # grep leader/etc/gshadowleader :!: 2) groupmodgroupmod is used to modify the existing group account of the system. The format is as follows: groupmod [options] GROUP where: GROUP: is a common option for the GROUP account name to be modified:-g GID: re-assign GID-n NEW_GROUP: Change the GROUP name NEW_GROUP. Example: rename the leader Group to leaders # groupmod-n leaders leader # grep leader/etc/groupleaders: x: 504: change the GID of the leaders Group to 3000 # groupmod-g 3000 leaders # grep leader/etc/groupleaders: x: 3000: 3) groupdelgroupdel to delete the group account that already exists in the system. The format is as follows: groupdel GROUP where: GROUP is the name of the GROUP account to be deleted, for example: delete the leaders group # groupdel leaders # grep leaders/etc/group # grep leaders/etc/gshadow user management 1) useradduseradd is used to add user accounts or set default information for adding users. Format: Format 1: useradd [options] LOGIN Format 2: useradd-D Format 3: useradd-D [options] Description: Format 1: Used to add user accounts, LOGIN is in the format of User Logon account 2: used to display the default information format used to add users 3: used to set the default information used to add users add user options: option description-u UID specifies the UID of the new user. By default, the current largest UID and 1-g GROUP are used to specify the master GROUP of the new user-G GROUP1 [, GROUP2 ,... [, GROUPN] specifies the new user's additional group-d HOME_DIR specifies the logon directory of the new user-s SHELL specifies the Shell used by the new user. The default option is bash to change the user's default value: in the configuration file/etc/login. defs and/etc/default/useradd store user default data. Example: 1. Create a new user newuser and the user's own directory # useradd newuser2. Create a new user tom, at the same time, join the staff additional group # useradd-G staff tom3, create a new user webmaster, do not create the user's own directory, specify the login directory/www, at the same time, add # useradd-d/www-M-G apache webmaster 2) usermodusermod to modify the existing group account of the system. The format is as follows: usermod [options] LOGIN where: LOGIN: indicates the option of the user account to be modified: -c,-d,-e,-f,-g,-G,-s, and-u have the same meanings as the useradd option. The following options are added:-l NEW_LOGIN: changing a user login name to a NEW_LOGIN-c COMMENT represents additional information about the user, such as the full name-e EXPIRE_DATE specifies the user's logon expiration time, the format is YYYY-MM-DD-f INACTIVE, which specifies the number of days after the password expires to close the account. The default value is-1, that is, no limit is imposed on-k SKEL_DIR to specify the skel directory, by default, it is stored in/etc/skel/-m to create the directory of the new user. The default value-M is not to create the directory of the new user. The option-B BASE_DIR defines the parent directory of the user's directory. The user name is appended to BASE_DIR to create a new user directory. Of course, this option is invalid when-d is used. -EEXPIRE_DATE defines the expiration date of the user account. -F INACTIVE defines how many days after the password expires to close the account. -G GROUP defines the start GROUP name or GID of the new account. The group name must be an existing group name. The GID must also be an existing GID. -S SHELL defines the shell used by the user by default. -L: locking the user account-U: Unlock the user account for example: 1. Add newuser2 to the staff group # usermod-G staff newuser22, change newuser's username to newuser1 # usermod-l newuser1 newuser3, lock account newuser1 # usermod-L newuser14, and unbind newuser1 lock # usermod-U newuser1 3) userdeluserdel is used to delete an existing group account in the system. The format is as follows: userdel [-r] LOGIN where: LOGIN: indicates the name of the user account to be deleted-r: deletes the user's own directory and the offline files of mail at the same time, for example: 1. Delete the user webmaster # userdel webmaster2. Delete the user newuser1 and its own directory # userdel-r newuser1