Create a Group in Kali Linux

Applies to Kali and most Linux distributions. Requires administrative privileges.

Command Syntax

sudo groupadd [OPTIONS] <group_name>

Examples

1) Create a basic group

sudo groupadd students

2) Create a group with a specific GID

sudo groupadd -g 1050 developers

This creates a group named developers with Group ID (GID) 1050.

Verify the Group

getent group students
# or
cat /etc/group | grep students

Add Users to the Group

Add an existing user to a supplementary group

sudo usermod -aG students alice

Check a user’s group memberships

groups alice
id alice

Use Groups with File Permissions

After creating a group and adding users, you can assign group ownership to files or directories:

# change group ownership
sudo chgrp students /srv/lab

# change owner and group together
sudo chown alice:students /srv/lab

# make directory group-writable and setgid so new files inherit the group
sudo chmod 2775 /srv/lab
Why groups? Groups let multiple users share access to the same resources securely. Combine groupadd, usermod -aG, chgrp/chown, and chmod to control collaborative access.

Troubleshooting & Notes