useradd
Create a new user or update default new user information
Overview
The useradd command creates a new user account or updates default new user information from the command line.
Syntax
useradd [options] LOGINCommon Options
-c comment, --comment commentAny text string. It is generally a short description of the login, and is currently used as the field for the user's full name.
-d home_dir, --home home_dirThe new user will be created using home_dir as the value for the user's login directory.
-e expire_date, --expiredate expire_dateThe date on which the user account will be disabled. The date is specified in the format YYYY-MM-DD.
-g initial_group, --gid initial_groupThe group name or number of the user's initial login group.
-G group,[,...], --groups group,[,...]A list of supplementary groups which the user is also a member of.
-m, --create-homeCreate the user's home directory if it does not exist.
-M, --no-create-homeDo not create the user's home directory.
-s shell, --shell shellThe name of the user's login shell.
-u uid, --uid uidThe numerical value of the user's ID. This value must be unique, unless the -o option is used.
-p password, --password passwordThe encrypted password, as returned by crypt(3). Use with caution, as the password is visible on the command line.
-r, --systemCreate a system account.
Examples
Creates a new user named newuser with default settings.
Creates user jdoe with a home directory, bash shell, and full name comment.
Creates tempworker, adds them to developers and testers groups, with an account expiry date.
Creates a system user appuser with no login shell.
Creates a user with a specific UID 1001.