Add/delete Linux users and groups and delete user groups in linux

Source: Internet
Author: User

Add/delete Linux users and groups and delete user groups in linux

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 row that belongs to the user 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


In linux, how does one delete a user from a group and how does one delete a user from a group:
Edit/etc/group and find GROUP1 to delete
Or use the command

Gpasswd-d A GROUP

Add a working group for existing users:
Usermod-G groupname username
Or: gpasswd-a user group
References: http://blog.sina.com.cn/s/blog_a6dcb5bd01017d0x.html
Which of the following users has the highest permissions in Linux? What are the Shell commands for adding new users and groups? Root Super privilege user
Add users and groups using useradd groupadd or adduser addgroup
When you directly modify the/etc/passwd/etc/group file, you can also add users and groups.
Never use Baidu to search for it. it will waste a lot of time.

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.