Users and user group management
- Command groupadd: New User Group
The format for the new user group: groupadd [-g GID] groupname
Example:
When no -g gid in accordance with the system default create groups
Gid create custom groups of acceleration when -g
- Command groupdel: Delete User Group
Delete a user group in the format: groupdel User Group Name
Example:
There is one group can not be deleted: you must delete the account in order to delete a group when the group contains accounts
- Command useradd: add new users
Add new users format is: useradd -u UID] [[- g GID] [- d HOME] [- M] [- s]
In which the specific meaning of each option are as follows:
-U: represents the custom UID.
-g: represents the new user belongs to a group that already exists, the back can id with the group, you can also name with the group.
-d: indicates that the custom user's home directory.
-M: said they did not establish a home directory.
-s: represents the custom shell.
Example: If useradd without any options, directly with the user name, a group with the same name as the user is created
Have to define uid, gid, or belongs to the group, examples of the command is as follows:
If the latter -g option with gid does not exist, an error is reported, suggesting that the group does not exist
- Command: userdel Delete account
Format delete the account is: userdel [-r] account name
-R role option is that when deleting users, also delete that user's home directory.
Example: do not add -r:
Plus -r
First, the user password management
- Command passwd: password
Example:
- Switching user identity
To create a new user and set a password for him, with which the user can log in again
- Su command to switch users
Format: su (-) User Name
Example:
- Command mkpasswd
- Mkpasswd command is used to generate the password. Linux is not the default order, you need to install a software package expect, the installation command as follows:
# yum install -y expect
# mkpasswd -1 12 -s 0 -d 3
In the embodiment, -s specified number of special characters, the number of digits specified -d.