The main commands are:
Group: Groupadd, Groupmod, Groupdel
Users: Useradd, Usermod, Userdel
Certification: passwd
Group Resolution library File:/etc/group
Grpname:x:gid:user1, User2, ...
Group name: Password dot: GID: A list of users with this group as additional groups, separated by commas
Groupadd command: Adding a group
Groupadd [Options] Group
-G GID: indicates GID;
-R,--system: System group;
Groupmod Command: Modify group information
groupmod [Options] GROUP
-G GID
-N new_name: Modify group name;
Groupdel command: Delete a group
Groupdel [Options] GROUP
User Resolution Library:/ETC/PASSWD
Name:password:UID:GID:GECOS:directory:shell
Useradd command: Add user
useradd [Options] Login name
-C,--comment Comment: annotation information, generally full Name;
-D,--home/path/to/home_dir: Home directory path, the target path can not be pre-existing, otherwise there will be a warning, will not gain Skel related files to the user;
-G,--gid Group: The user's basic group name or GID;
-G,--groups group1[,group2,... [, GROUPN]] : The list of additional groups to which the user belongs, separated by commas, with no spaces in between;
-M,--create-home: Forced to create home directory;
-M: Do not create user home directory, even if the system is set in/etc/login.defs (Create_home) is yes;
-R,--system: Create a System account
-S,--shell Shell: The user's login shell name, default is left blank, let the system according to the shell variable in the/etc/default/useradd to select the default login shell;
-U,--uid UID: The numeric value of the user ID. This value must be unique unless the-o option is used. This value must be non-negative, with a default value greater than or equal to uid_min, and greater than any other user ID minimum.
Note: When you create a signed-in user, the shell program for which you are customizing must be a login shell and be located in the/etc/shells file;
Useradd-d: Displays the default settings when creating a user;
useradd-d option: Set a default option;
-E,--expiredate expire_date: Expiration of user account, locked after expiration, date specified in YYYY-MM-DD format
-F,--inactive inactive: The number of days before the account is completely disabled after the password expires. 0 means disable now, 1 means disable this feature.
To provide the user with a default configuration profile:
/etc/login.defs,/etc/default/useradd
Shadow password file:/etc/shadow
Login Name: Password: Last modified: Minimum password Age: Maximum password Age: Number of days ahead of warning: Inactive period: Date of inactivity: Reserved field
Usermod Command: Modify account information
-C,--comment comment
-D,--home Home_dir: Modifies the home directory to a new location, but should generally use the-m option to ensure that the files in the original home directory are moved to the new directory;
-G,--gid GROUP
-G,--groups group1[,group2,... [, GROUPN]] : The original additional group is overwritten when modified, and the-a option is used together to indicate adding new additional groups to the user;
-L,--login new_login: Modifies the user name of the current user;
-S,--shell shell
-U,--uid uid
-L,--lock: Locks the user's password. This will place a "!" before the user encrypts the password.
-U,--unlock: Unlocks the user's password. This will remove the encrypted password before the "!"
Userdel command: Delete user account
Userdel [Options] Login name
-R,--remove: Files in the home directory will be deleted with the user's main directory and the user's mailbox
passwd command: Password management commands
passwd [-L] [-u [-f]] [-d] [-e] [-N mindays] [-X Maxdays] [-W warndays] [-i-inactivedays] [--stdin] [username]
(1) passwd: Modify your password;
(2) passwd Username: Modify other user's password, only root has this permission;
Password complexity:
(1) not less than 8 characters;
(2) You cannot use passwords that are too similar to past passwords;
(3) At least three classes of four characters should be used;
Options:
-L: Lock password
-U: Unlocking and decrypting
-D: Clear Password
ID Command: View user-related ID information;
ID [OPTION] ... [USER]
-U: View UID only
-G: View GID only
-G: View the ID of all groups that belong to;
-N: Display name, not ID;
SU command: Switch user
When switching users:
(1) Do not read the target user's profile (non-login switch, half switch);
Su USERNAME
(2) Read the target user's configuration file (login switch, complete switch);
Su-l USERNAME
Su-username
-C command,--command=command: Runs the commands specified here only as the specified user, without performing a true identity switch operation;
Note: Root switch to any other users without authentication password, normal user switch to other users, all require a password;
GPASSWD command: Add a password to a group
Group Password file:/etc/gshadow
GPASSWD [Options] Group
-A USERNAME: Add the user to the group;
-D USERNAME: Remove this user from this group;
NEWGRP command: Log in to a new group
Chage command: Modify the user account for various deadlines;
This article is from the "11284919" blog, please be sure to keep this source http://11294919.blog.51cto.com/11284919/1755508
User, group management in Linux