Add and delete users and user groups in Linux

Source: Internet
Author: User
Add and delete users and user groups in Linux-Linux general technology-Linux technology and application information. For more information, see the following. 1. User Creation:

Adduser phpq // create a phpq user

Passwd phpq // set a password for the phpq user

2. Create a working group

Groupadd test // create a test workgroup

3. Create a user and add a Working Group

Useradd-g test phpq // create a phpq user and add it to the test workgroup

Note: SHELL used by-g's group-d home directory-s

4. Add a working group for existing users

Usermod-G groupname username

Or: gpasswd-a user group

5. temporarily close: Add * before the second field (password) of the user's row in the/etc/shadow file. To restore the user, remove.

You can also use the following command to disable the user account:

Passwd peter? L

Release again:

Passwd peter? U

6. Permanently delete user accounts

Userdel peter

Groupdel peter

Usermod? G peter (Force delete all files and subdirectories in the user's home directory and Home Directory)

7. delete a user from the group

Edit/etc/group, locate the GROUP1 line, and delete

Or use the command

Gpasswd-d A GROUP

8. Display User Information

Id user

Cat/etc/passwd

For more information about users and user groups, see

Linux users and user groups

This document describes the concepts of user and group management in Linux, and lists commands related to user and group; it also provides explanations on single-user multi-task and multi-user multi-task.
Related Article

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.