User and Group Management 1. Basic concepts of users and groups
The role of users (1) View the currently logged in user information: [root@192 ~]# id (2) View the owner of the file: [root@192 ~]# ls -l /home (3) View the username of the running process: [root@192 ~]# ps axu User group information storage file (1) User basic information file: [root@192 ~]# cat /etc/passwd /etc/passwd (colon-separated into 7 columns) System convention: RHEL7 meaning: (2) User password information file: [root@192 ~]# cat /etc/shadow /etc/shadow (colon-separated into 9 columns) 2) The "Password" field stores the encrypted user password. If it is empty, the corresponding user has no password and does not need a password when logging in; 3) "Last modification time" indicates the number of days from a certain moment to the last time the user changed the password. The starting time may be different for different systems. For example, in SCOLinux, the starting point is January 1, 1970. 4) "Minimum time interval" refers to the minimum number of days required between two password changes. 5) "Maximum time interval" refers to the maximum number of days a password remains valid. 6) The "Warning Time" field indicates the number of days from when the system starts warning the user to when the user's password officially expires. 7) “Inactivity time” refers to the maximum number of days that a user can remain valid without logging in. (Soft limit. The number of days after the expiration date the account cannot be used.) 8) The "Expiration Time" field gives an absolute number of days. If this field is used, it will give the life span of the corresponding account. After the expiration, the account is no longer a valid account and can no longer be used to log in. (Hard limit.) 9) Retention (3) Group information file: [root@192 ~]# cat /etc/group /etc/group (colon-separated into 4 columns) 2. User/Group Management user (1) Create a user without specifying options: [root@192 ~]# useradd user01 summary: (2) Create user-specified options: [root@192 ~]# useradd user02 -u 1503 //Create user user02 and specify uid [root@192 ~]# useradd user03 -d /aaa //Create user user03 and specify the home directory (3) Deleting a user: [root@192 ~]# userdel -r user02 (4) User password: Method 1: Root changes the password of other users (user03). [root@192 ~]# passwd user03 Method 2: User (user03) logs in and changes the password himself. [user03@192 ~]$ passwd (5) Group member management: Note: usermode -G group name user name [root@192 ~]# usermod -G hr user03 (6) Other option management: [root@192 ~]# usermod -s /sbin/nologin user03 Modify the login shell to restrict user03 from logging in User Groups (1) Create a group without specifying options: [root@192 ~]# groupadd db (2) Create a group to specify options: [root@192 ~]# groupadd net01 -g 2000 //Add group net01 and specify gid 2000 (3) View group information: [root@192 ~]# grep 'net01' /etc/group //View the information of group net01 in /etc/group (4) Delete a group [root@192 ~]# groupdel net01 //Delete group net01 Because it has been deleted, it is not displayed when viewing. Classification (1) Basic group/main group The basic group of the user with the same name is automatically created when the user is created, and is displayed in /etc/passwd (2) Additional group Other groups the user is a member of. Command Summary 1 useradd is the command to create a user. This concludes this article about the summary of Linux system user management commands. For more relevant Linux system user management commands, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of how to connect Java to Mysql version 8.0.18
>>: Interviewers often ask questions about React's life cycle
When uploading on some websites, after clicking t...
Three-way handshake phase Number of retries for c...
Preface When mysql modified the default database ...
1. haslayout and bfc are IE-specific and standard ...
I searched a lot of articles online but didn'...
This article mainly introduces the sample code of...
Let's take a look at zabbix monitoring sqlser...
Table of contents From father to son From son to ...
This article example shares the specific code for...
background We often use Chrome Dev Tools for deve...
Table of contents Usage scenarios Solution 1. Use...
How to write judgment statements in mysql: Method...
Click here to return to the 123WORDPRESS.COM HTML ...
The page length in the project is about 2000px or...
1. Check whether the existing nginx supports ipv6...