Product SiteDocumentation Site

A.5.8. user (optional) - Create User Account

Creates a new user on the system.
user --name=username [options]
--name=
Provides the name of the user. This option is required.
--gecos=
Provides the GECOS information for the user. This is a string of various system-specific fields separated by a comma. It is frequently used to specify the user's full name, office number, etc. See the passwd(5) man page for more details.
--groups=
In addition to the default group, a comma separated list of group names the user should belong to. The groups must exist before the user account is created. See Section A.5.2, “group (optional) - Create User Group”.
--homedir=
The home directory for the user. If not provided, this defaults to /home/username.
--lock
If this option is present, this account is locked by default. This means that the user will not be able to log in from the console.
--password=
The new user's password. If no password is provided, the account will be locked.
--iscrypted
If this option is present, the password argument is assumed to already be encrypted. This option is mutually exclusive with --plaintext. To create an encrypted password, you can use Python:
$ python -c 'import crypt; print(crypt.crypt("My Password", "$6$My Salt"))'
This will generate a SHA512 crypt of your password using your provided salt.
--plaintext
If this option is present, the password argument is assumed to be in plain text. This option is mutually exclusive with --iscrypted.
--shell=
The user's login shell. If not provided, the system default will be used.
--uid=
The UID (User ID). If not provided, this defaults to the next available non-system UID.
--gid=
The GID (Group ID) to be used for the user's default group. If not provided, this defaults to the next available non-system group ID.