In Linux you can assign user accounts to one or more groups and thus control file permissions or access to directories. This is important, because not every user should be able to use the same rights within an operating system.

If you want to add a user to a group within the Linux operating system, you may ask yourself how you can best do this. We would like to explain to you here, how you proceed thereby best under Linux.

To assign a user to a group under Linux

How to add user to group - Linux

1. Open the terminal for example by CTRL + ALT + T

2. Now use the following command

  • Sudo usermod -a -G group username

Here, "group" must be replaced by the group to which the user is to be assigned.  The "username" must be replaced with the user you want to assign to the group.

Example:

You want to assign the user "Max" to the group "Spickipedia". Then the command would be as follows:

  • Sudo usermod -a -G Spickipedia Max

You have now successfully assigned a user to a specific group.

If you have not yet created a group on Linux, then you can quickly create one as follows:

How to create a new group on Linux

To create a new group on your system, use the following command:

  • sudo groupadd group

Here, replace "group" with the name of the new group.

Example:

  • sudo groupadd Spickipedia

With this, you have now created a new group in Linux and can assign users there using the above method.

You now know the procedure for assigning users to a group in Linux.

{tag}link rel="alternate" href="https://www.spickipedia.com/index.php/computer/linux-benutzer-zur-gruppe-hinzufuegen-so-geht-s.html" hreflang="de" {/tag}
{tag}link rel="alternate" href="https://www.spickipedia.com/en/computer/add-linux-user-to-group-how-to-do-it" hreflang="en" {/tag}
{tag}link rel="alternate" href="https://www.spickipedia.com/fr/ordinateur/ajouter-des-utilisateurs-a-un-groupe-sous-linux-voici-comment-proceder" hreflang="fr" {/tag}
{tag}link rel="alternate" href="https://www.spickipedia.com/es/ordenador/anadir-usuarios-de-linux-a-un-grupo-asi-es-como-funciona" hreflang="es" {/tag}

Add comment

Submit