useradd

useradd

Sure. The useradd command in Linux is used to create a new user account. The syntax for the useradd command is as follows:

useradd [options] username
  • options: These are optional flags that can be used to control the behavior of the useradd command.

  • username: This is the name of the new user account.

The useradd command has a number of options that can be used to control the creation of the user account. Some of the most commonly used useradd options are:

  • -m: This option specifies that the user's home directory should be created.

  • -d: This option specifies the path to the user's home directory.

  • -g: This option specifies the group that the user will belong to.

  • -s: This option specifies the shell that the user will use.

For example, the following command will create a new user account named johndoe with a home directory in the /home/johndoe directory and a shell of /bin/bash:

useradd -m -d /home/johndoe -g users -s /bin/bash johndoe

The useradd command is a valuable tool for system administrators who need to create new user accounts. It can also be used by users who want to create their own user accounts.

help

Last updated