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)
Table of contents Drop-down multiple-select box U...
Mysql stored procedure 1. Create stored procedure...
1. Why write this article? You must have read a l...
Web Services are concerned with application-to-ap...
background CVE-2021-21972 An unauthenticated comm...
This article shares simple HTML and music player ...
1. First stop the mysql service As an administrat...
In the project (nodejs), multiple data need to be...
This article example shares the specific code of ...
CSS writing order 1. Position attributes (positio...
Table of contents Effect display Code Link Key Co...
Before starting the main text, I will introduce s...
MySQL5.7.21 installation and password setting tut...
introduction Currently, k8s is very popular, and ...
Beautiful code is the foundation of a beautiful we...