Linux User Group Management

Source: Internet
Author: User

Add User Group Command Groupadd

Syntax: Groupadd [-G GID] [-r] Group_name

-G: Specify user group ID

-r: Specify user group as System user group

Example:

[[email protected] ~]# groupadd testgrp[[email protected] ~]# grep testgrp/etc/group/etc/gshadow/etc/group:testgrp:x : 503:/etc/gshadow:testgrp:!::

change user group Parameters command Groupmod

Syntax: groupmod [-G GID] [-N group_new_name]group_old_name

-G: Change user group ID

-N: Change user group name

Example:

[[email protected] ~]# groupmod-g 504-ngroup1 testgrp[[email protected] ~]# grep group1/etc/group/etc/gshadow/etc/group : group1:x:504:/etc/gshadow:group1:!::

Delete User Group command Groupdel

Syntax: Groupdel [group_name]

Example:

[Email protected] ~]# Groupdel group1

Note: If this user group is the initial user group of a user, the user group cannot be deleted, but the user group can be deleted by changing the user's initial user group ID or by deleting the user.

[Email protected] ~]# Groupdel whxgroupdel:cannot Remove the primary groupof user ' whx '

User group Administrator function gpasswd

For root user actions:

Syntax: GPASSWD group_name

gpasswd [-A user_name1,...] [-M user_name2,...] Group_name

GPASSWD [-RR] Group_name

Set a password for a user group when no parameters are added

-A: Specify the administrative user for the user group

-M: adding user Group members

-r: Delete user group password

-R: Invalid user group password bar

For user group Administrator actions:

Syntax: gpasswd [-AD] user_name Group_name

-A: Add user group members

-D: Delete user Group members

Example:

[[email protected] ~]# groupadd testgrp[[email protected] ~]# gpasswd  Testgrpchanging the password for group testgrpnew password:re-enter new  password:[[email protected] ~]# gpasswd -A xx testgrp[[email  Protected] ~]# grep testgrp /etc/group/etc/gshadow/etc/group:testgrp:x:503:/etc/gshadow: testgrp:$1$mxatf/sr$nudqk9ytidegnk0qkjybh0:xx:[[email protected] ~]# su xx[[email  protected] root]$ cd ~[[email protected] ~]$ iduid=501 (XX)  gid=501 (XX) groups=501 (XX), (WHX) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023[[email protected]  ~]$ gpasswd -a xx testgrpadding user xx to group testgrp[[ email protected] ~]$ gpasswd -a whx tesetgrpgpasswd: group  ' Tesetgrp '  does not exist in/etc/group[[email protected] ~]$ gpasswd -a whx testgrpadding user  whx to group testgrp[[email protected] ~]$ grep testgrp /etc/ Grouptestgrp:x:503:xx,whx


This article is from the "Dark Shun" blog, please make sure to keep this source http://mjal01.blog.51cto.com/12140495/1971080

Linux User Group Management

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.