> For the complete documentation index, see [llms.txt](https://noreply.gitbook.io/born2beroot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://noreply.gitbook.io/born2beroot/virtual-machine-setup/installing-sudo-and-configuration-of-user-and-groups/adding-a-user-to-a-group.md).

# Adding a user to a group

## How to add users to groups

1. **Add user to group:** We can add a user to a group using the `adduser` command with this syntax:

```sh
sudo adduser <username> <groupname>
```

**For our Born2BeRoot project, we need to add our user to both the `sudo` and `user42` groups:**

```sh
sudo adduser gemartin user42
```

```sh
sudo adduser gemartin sudo
```

{% hint style="info" %}
Replace `gemartin` with your actual username.
{% endhint %}

2. **Verify group membership:** Once completed, we can verify the user has been added to the groups using:

```sh
getent group sudo user42
```

This command will show the groups `sudo` and `user42` with our user listed as a member.

<figure><img src="https://3975474142-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvxQldFCzdjsw8BkClhdK%2Fuploads%2Fgit-blob-064de567ebddb7d42d133ed1332017724d2c7fec%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3975474142-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvxQldFCzdjsw8BkClhdK%2Fuploads%2Fgit-blob-4b704cc1e9105fa4becfc8d162b4ef863ae0510a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
