Linux Add/Remove users and user groups

Source: Internet
Author: User

This article summarizes some of the commands and parameters that are commonly used when adding or removing users and user groups from Linux.
1, Build Users:
AddUser PHPQ//New PHPQ User
passwd PHPQ//Set password for PHPQ user

2. Build Working Group
Groupadd test//New test Workgroup

3, new users at the same time increase the Working group
USERADD-G test PHPQ//new PHPQ user and added to test workgroup

Note::-G belongs to the group-D home Directory-S used by the shell


4. Increase the Working Group for existing users
USERMOD-G groupname username

Or: Gpasswd-a user Group

5. Temporary shutdown: The second field (password) in the/etc/shadow file that belongs to the user is preceded by a *. To restore the user, remove the *.

Or, use the following command to close the user account:
passwd peter–l

Re-release:
passwd Peter–u

6. Permanently delete user account
Userdel Peter

Groupdel Peter

Usermod–g Peter Peter (Force delete all files and subdirectories in the user's home directory and home directory)

7. Remove users from the group
Edit/etc/group Find the GROUP1 line, delete A
or with a command.
gpasswd-d A GROUP

8. Display user Information
ID User
cat/etc/passwd

For more detailed explanations of users and user groups, please refer to
Detailed explanation of Linux users and user groups
This paper mainly describes the concepts of user and user group management in Linux system, the enumeration of user and user groups (group) commands, and also the multi-tasking of single users and multi-user multitasking.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.