https://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/

How do I list the members of a group?

https://askubuntu.com/questions/136788/how-do-i-list-the-members-of-a-group

  1. Use the getent commands:
$ getent group <group-name>

or

$ getent group <group-name>  | awk -F:  '{print $4}'

  1. Use members command and it will list all users in the group you chose
    You may need to install it:
$ sudo apt-get install members

Add User and Group

  • Add a user group :
$ adduser --group [--gid ID] <GROUP>
# or,
$ addgroup [--gid ID] <GROUP>

  • Add a system group :
$ addgroup --system [--gid ID]  <GROUP>

  • Add an existing user to an existing group :
$ adduser  <USER>  <GROUP>

Example. Create new user manager and group admin,
and add the user manager to the admin group:

# created user name and group name are the same.
$ adduser manager

# create new group `admin`:
$ addgroup admin

# Add the user `manager` to the `admin` group :
$ adduser  manager  admin

# Check the `admin` group members:
$ getent group  admin

# or,
$ getent group admin | awk -F:  '{print $4}'

Leave a Reply