This post is a brief description of the very basic tools used to manage users and groups in uBuntu. Like many of my posts, this list is a quick reference of stuff you probably already know and have used before.

Add and Remove users

Add a new user. This command also creates a home directory at /home/username

adduser username

Delete a user. This command also removes the user’s home directory.

sudo deluser --remove-home username

Add and Remove Groups

Before creating a group, check if it exits

grep developers /etc/group

Then to create the group:

sudo addgroup superuberusergroup

Assign a user to groups

See what groups the user is in:

id username

Set a user’s primary group:

usermod -g primarygroup username

Add a user to another group:

usermod -a -G anothergroup username

Set resource permissions

Change ownership of resources. This command recursively sets the group owner of a file or folder to the specified group

sudo chown -R :GROUPNAME location_of_resources

Make resources group writeable. This command sets the ‘group writeable’ flag on a resource

chmod -R g+w location_of_resources