Linux adds a new group to the user

Source: Internet
Author: User

Add a new group to the user User1 group1

Usermod-g group1   #给当前登录用户所在组设置为 group1

Note: The above command has a problem to know, this operation is to reset the user group, that is, the current user will leave the original group, and then add to the new group.

To increase the group only, do not change the original group, you can use:

Usermod-a-G group1 user1

This allows a user1 to add a group1 group.

And sometimes executing the above command will cause an error:

Usermod:cannot lock/etc/passwd; Try again later

You can re-execute the following command:

sudo --usermod–g group1 user1

Then log in again and look at the group where the user is currently logged in:

Groups

You will find that you have added a group1 group.

Linux adds a new group to the user

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.