User and User group management
Linux is a multi-user multi-tasking time-sharing operating system, all users who want to use the system resources must first request an account from the system administrator, and then enter the system as the identity of the account. On the one hand, the user's account can help the system administrator to track the users who use the system and control their access to system resources, as well as to help users organize files and provide security protection for users. Each user account has a unique user name and user password. Users can enter the system and their home directory by typing the correct user name and password when they log on.
User and user group profiles
The management of user accounts mainly involves the addition, deletion and modification of user accounts.
To add a user account is to create a new account in the system, and then assign the user number, user group, home directory, and login shell resources to the new account. ,
The user is added mainly in the user profile to write new user information, mainly including the following configuration files: User information file vim/etc/passwd, shadow file Vim/etc/shadow, group information file Vim/etc/group, group password file vim/ Etc/gshadow.
Let me explain the contents of each file:
1. User Information file vim/etc/passwd
User name: Password flag: User ID (0/1-499/500-65535): GID (user initial group ID): User description: Shell after login
2. Shadow File Vim/etc/shadow
User name: encryption password (! or * indicates no password can not login): Password Last modified: Two password modification interval: password validity period: password changes before the warning days: password expires after the number of days (0: password expires immediately after expiration, 1: Never expire): Account Expiration Time
3. Group information file Vim/etc/group
Group name: group Password flag: GID: Additional user in Group
4. Group Password file Vim/etc/gshadow
Group name: Group Password: Group Admin User: additional users in Group
User-related files
In addition to some configuration files, users will automatically generate some user-related files, mainly including the following files:
Home directory: Ordinary user/home/, user name Super User/root/.
User's mailbox:/var/spool/mail/user name/.
User Templates directory:/etc/skel/(Files generated in the home directory after a new user is created).
Command
Here are some user-managed commands:
Useradd user name → add new user
-U uid→ manually specifying the UID number of the user
-d home directory → manually Specify the user's home directory
-c user Description → Manually specify the user's description
-g group name → manually Specify the user's initial group
-G Group name → additional groups of specified users (with, separate)
-S shell→ manually specify the user's login shell. Default is/bin/bash
passwd command:
To modify the user Information Usermod command:
To modify the user password status chage:
Modify Group Groupmod
Delete User userdel:
ID user name → view User ID
SU command:
env→ Viewing user environment variables
Su–root–c "Useradd zzz" → does not switch root, but executes the useradd command to add the ZZZ user
[20150529] User and user group management-Zhu Xiaoyang