Forrest logo
back to the useradd tool

useradd:tldr:f7ef3

useradd: Create a new user belonging to additional groups (mind the lack of whitespace).
$ sudo useradd --groups ${group1,group2,---} ${username}
try on your machine

This command is used to create a new user and add them to one or more existing groups on a Unix-like system. Let's break down the command:

  • sudo: This is a command that grants administrative or superuser privileges to the user who executes it. It allows the user to perform actions that require elevated permissions.

  • useradd: This is the command used to create a new user account on the system.

  • --groups ${group1,group2,---}: This option specifies the groups to which the new user should be added. You can provide a comma-separated list of group names inside the curly braces (${ }) to specify multiple groups. Replace ${group1,group2,---} with the actual names of the groups you want to add the user to.

  • ${username}: This is the username for the new user. Replace ${username} with the desired username for the user you want to create.

By using this command, you can create a new user and assign them to one or more groups to manage their access permissions and privileges on the system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the useradd tool