• Uncategorized
  • 7

The groupmems command’s switches with example – Unix/Linux

The command ‘groupmems’ is used to administrate Linux groups.
Syntax:

# groupmems -a user_name | -d user_name | [-g group_name] | -l | -p

Switches with example:

1, -a, –add user_name

Add an user to the group membership list.
If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created.

[root@localhost ~]# groupmems -g grptest -a crybit
[root@localhost ~]# groupmems -g grptest -a crybit 
groupmems: user 'crybit' is already a member of 'grptest'
[root@localhost ~]# groupmems -g grptest -a me

2,-d, –delete user_name

Delete a user from the group membership list.
If the /etc/gshadow file exist, the user will be removed from the list of members and administrators of the group.
If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created.

[root@localhost ~]# groupmems -g grptest -d crybit
[root@localhost ~]# groupmems -g grptest -d crybit
groupmems: user 'crybit' is not a member of 'grptest'
[root@localhost ~]# groupmems -g grptest -d me

3, -g, –group group_name

The superuser can specify which group membership list to modify.

4, -l, –list

List the group membership list.
Example:

[root@localhost ~]# groupmems -g grptest -a me
[root@localhost ~]# groupmems -g grptest -a crybit
[root@localhost ~]# groupmems -g grptest -l
me  crybit

5, -p, –purge

Purge all users from the group membership list.
Example:

[root@localhost ~]# groupmems -g grptest -l
me  crybit 
[root@localhost ~]# groupmems -g grptest -p
[root@localhost ~]# groupmems -g grptest -l

Its simple, right? 🙂

groupdel, groupadd, groupmod,

Arunlal Ashok

Sr. Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile in uPwork (oDesk) and create a job, if you need any administration help. Thanks!!

You may also like...

7 Responses

  1. February 1, 2014

    […] Links : groupadd , groupmems, […]

  2. February 1, 2014

    […] Links: groupdel, groupmems, groupmod, […]

  3. February 1, 2014

    […] Links: groupdel, groupmems, groupmod, […]

  4. February 1, 2014

    […] Links: groupdel, groupmems, […]

  5. February 6, 2014

    […] commands, groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, […]

  6. February 7, 2014

    […] useful commands: groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp […]

  7. February 7, 2014

    […] useful commands: groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp commands, […]

Leave a Reply

Your email address will not be published. Required fields are marked *