This article summarizes the common commands for Linux user and group management. Share with you for your reference, the details are as follows: 1. The user belongs to a user group. 2. User and User Group Profiles 1) User group configuration file
First column: group name of the user group Second column: group password (the real password is stored in gshadow) 2) User group password configuration file
First column: User group name Second column: Password Third column: Group administrator Fourth column: Group member 3) User Profile
First column: User name Second column: User password, only one x placeholder, the password is stored in shadow Third column: User ID, unique identifier 4) User password configuration file
First column: User name Second column: Password (!! means no password, login is not allowed) 3. User group management groupadd group name to add user group groupmod group name modifies user group information groupdel group name delete group *If there are users under a group, the group cannot be deleted. 4. User Management useradd [parameter] user name add user *When adding a user, if you do not specify a group, the system will create a group with the same name as the user. usermod [parameter] username userdel [parameter] user name 5. Password Management passwd [options] username 6. Prohibit account login There are two situations:
Modify the shadow directly and add two before the user password! No., prohibiting the user from logging in. It is recommended to use: passwd -l username to prohibit user login. Prohibit all accounts from logging in
Create a nologin file under /etc/ so that no users can log in. 7. Add and delete group members *usermod -g is to modify the user's primary group gpasswd [options] groupname The default identity of a user after logging in is his primary group identity. You can use newgrp to switch the group identity to which it belongs, provided that it also belongs to this group. The created file belongs to the group to which the current user identity switches. I hope this article will be helpful to everyone's Linux management. You may also be interested in:
|
<<: Detailed steps to install MYSQL8.0 on CentOS7.6
>>: SQL interview question: Find the sum of time differences (ignore duplicates)
The following three methods are commonly used to d...
In this article, we’ll explore how async/await is...
Preface Sometimes you need to keep the height of ...
Detailed explanation of MySQL sorting Chinese cha...
Table of contents 1.Nuxt server-side rendering ap...
Table of contents Proper use of indexes 1. Disadv...
Database Command Specification All database objec...
Table of contents Preface text 1. Closure 1.1 Wha...
Table of contents 1. Foreign key constraints What...
Problem Description The button style is icon + te...
The data dictionary in MySQL is one of the import...
1. Introduction Recently, I often encounter devel...
Preface: Mybatis special character processing, pr...
One-click execution To install Python 3.8 in a vi...
Preface Starting from MySQL 5.7.11, MySQL support...