{
    "mode": "man",
    "parameter": "useradd",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/useradd/8/json",
    "generated": "2026-09-23T16:39:05Z",
    "synopsis": "useradd [options] LOGIN\nuseradd -D\nuseradd -D [options]",
    "sections": {
        "NAME": {
            "content": "useradd - create a new user or update default new user information\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "useradd [options] LOGIN\n\nuseradd -D\n\nuseradd -D [options]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "useradd is a low level utility for adding users. On Debian, administrators should usually use\nadduser(8) instead.\n\nWhen invoked without the -D option, the useradd command creates a new user account using the\nvalues specified on the command line plus the default values from the system. Depending on\ncommand line options, the useradd command will update system files and may also create the\nnew user's home directory and copy initial files.\n\nBy default, a group will also be created for the new user (see -g, -N, -U, and\nUSERGROUPSENAB).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the useradd command are:\n",
            "subsections": [
                {
                    "name": "--badname",
                    "content": "Allow names that do not conform to standards.\n",
                    "long": "--badname"
                },
                {
                    "name": "-b --base-dir _",
                    "content": "The default base directory for the system if -d HOMEDIR is not specified.  BASEDIR is\nconcatenated with the account name to define the home directory.\n\nIf this option is not specified, useradd will use the base directory specified by the\nHOME variable in /etc/default/useradd, or /home by default.\n",
                    "flag": "-b",
                    "long": "--base-dir"
                },
                {
                    "name": "-c --comment _",
                    "content": "Any text string. It is generally a short description of the account, and is currently\nused as the field for the user's full name.\n",
                    "flag": "-c",
                    "long": "--comment"
                },
                {
                    "name": "-d --home-dir _",
                    "content": "The new user will be created using HOMEDIR as the value for the user's login directory.\nThe default is to append the LOGIN name to BASEDIR and use that as the login directory\nname. If the directory HOMEDIR does not exist, then it will be created unless the -M\noption is specified.\n",
                    "flag": "-d",
                    "long": "--home-dir"
                },
                {
                    "name": "-D --defaults",
                    "content": "See below, the subsection \"Changing the default values\".\n",
                    "flag": "-D",
                    "long": "--defaults"
                },
                {
                    "name": "-e --expiredate _",
                    "content": "The date on which the user account will be disabled. The date is specified in the format\nYYYY-MM-DD.\n\nIf not specified, useradd will use the default expiry date specified by the EXPIRE\nvariable in /etc/default/useradd, or an empty string (no expiry) by default.\n",
                    "flag": "-e",
                    "long": "--expiredate"
                },
                {
                    "name": "-f --inactive _",
                    "content": "defines the number of days after the password exceeded its maximum age where the user is\nexpected to replace this password. The value is stored in the shadow password file. An\ninput of 0 will disable an expired password with no delay. An input of -1 will blank the\nrespective field in the shadow password file. See shadow(5)for more information.\n\nIf not specified, useradd will use the default inactivity period specified by the\nINACTIVE variable in /etc/default/useradd, or -1 by default.\n",
                    "flag": "-f",
                    "long": "--inactive"
                },
                {
                    "name": "-F --add-subids-for-system",
                    "content": "Update /etc/subuid and /etc/subgid even when creating a system account with -r option.\n",
                    "flag": "-F",
                    "long": "--add-subids-for-system"
                },
                {
                    "name": "-g --gid _",
                    "content": "The name or the number of the user's primary group. The group name must exist. A group\nnumber must refer to an already existing group.\n\nIf not specified, the behavior of useradd will depend on the USERGROUPSENAB variable in\n/etc/login.defs. If this variable is set to yes (or -U/--user-group is specified on the\ncommand line), a group will be created for the user, with the same name as her loginname.\nIf the variable is set to no (or -N/--no-user-group is specified on the command line),\nuseradd will set the primary group of the new user to the value specified by the GROUP\nvariable in /etc/default/useradd, or 100 by default.\n",
                    "flag": "-g",
                    "long": "--gid"
                },
                {
                    "name": "-G --groups _",
                    "content": "A list of supplementary groups which the user is also a member of. Each group is\nseparated from the next by a comma, with no intervening whitespace. The groups are\nsubject to the same restrictions as the group given with the -g option. The default is\nfor the user to belong only to the initial group.\n",
                    "flag": "-G",
                    "long": "--groups"
                },
                {
                    "name": "-h --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-k --skel _",
                    "content": "The skeleton directory, which contains files and directories to be copied in the user's\nhome directory, when the home directory is created by useradd.\n\nThis option is only valid if the -m (or --create-home) option is specified.\n\nIf this option is not set, the skeleton directory is defined by the SKEL variable in\n/etc/default/useradd or, by default, /etc/skel.\n\nIf possible, the ACLs and extended attributes are copied.\n",
                    "flag": "-k",
                    "long": "--skel"
                },
                {
                    "name": "-K --key _",
                    "content": "Overrides /etc/login.defs defaults (UIDMIN, UIDMAX, UMASK, PASSMAXDAYS and others).\n\nExample: -K PASSMAXDAYS =-1 can be used when creating an account to turn off password\naging. Multiple -K options can be specified, e.g.: -K UIDMIN =100 -K  UIDMAX=499\n\nFor the compatibility with previous Debian's useradd, the -O option is also supported.\n",
                    "flag": "-K",
                    "long": "--key"
                },
                {
                    "name": "-l --no-log-init",
                    "content": "Do not add the user to the lastlog and faillog databases.\n\nBy default, the user's entries in the lastlog and faillog databases are reset to avoid\nreusing the entry from a previously deleted user.\n\nIf this option is not specified, useradd will also consult the variable LOGINIT in the\n/etc/default/useradd if set to no the user will not be added to the lastlog and faillog\ndatabases.\n",
                    "flag": "-l",
                    "long": "--no-log-init"
                },
                {
                    "name": "-m --create-home",
                    "content": "Create the user's home directory if it does not exist. The files and directories\ncontained in the skeleton directory (which can be defined with the -k option) will be\ncopied to the home directory.\n\nBy default, if this option is not specified and CREATEHOME is not enabled, no home\ndirectories are created.\n\nThe directory where the user's home directory is created must exist and have proper\nSELinux context and permissions. Otherwise the user's home directory cannot be created or\naccessed.\n",
                    "flag": "-m",
                    "long": "--create-home"
                },
                {
                    "name": "-M --no-create-home",
                    "content": "Do not create the user's home directory, even if the system wide setting from\n/etc/login.defs (CREATEHOME) is set to yes.\n",
                    "flag": "-M",
                    "long": "--no-create-home"
                },
                {
                    "name": "-N --no-user-group",
                    "content": "Do not create a group with the same name as the user, but add the user to the group\nspecified by the -g option or by the GROUP variable in /etc/default/useradd.\n\nThe default behavior (if the -g, -N, and -U options are not specified) is defined by the\nUSERGROUPSENAB variable in /etc/login.defs.\n",
                    "flag": "-N",
                    "long": "--no-user-group"
                },
                {
                    "name": "-o --non-unique",
                    "content": "allows the creation of an account with an already existing UID.\n\nThis option is only valid in combination with the -u option. As a user identity serves as\nkey to map between users on one hand and permissions, file ownerships and other aspects\nthat determine the system's behavior on the other hand, more than one login name will\naccess the account of the given UID.\n",
                    "flag": "-o",
                    "long": "--non-unique"
                },
                {
                    "name": "-p --password _",
                    "content": "defines an initial password for the account. PASSWORD is expected to be encrypted, as\nreturned by crypt (3). Within a shell script, this option allows to create efficiently\nbatches of users.\n\nWithout this option, the new account will be locked and with no password defined, i.e. a\nsingle exclamation mark in the respective field of /etc/shadow. This is a state where the\nuser won't be able to access the account or to define a password himself.\n\nNote:Avoid this option on the command line because the password (or encrypted password)\nwill be visible by users listing the processes.\n\nYou should make sure the password respects the system's password policy.\n",
                    "flag": "-p",
                    "long": "--password"
                },
                {
                    "name": "-r --system",
                    "content": "Create a system account.\n\nSystem users will be created with no aging information in /etc/shadow, and their numeric\nidentifiers are chosen in the SYSUIDMIN-SYSUIDMAX range, defined in /etc/login.defs,\ninstead of UIDMIN-UIDMAX (and their GID counterparts for the creation of groups).\n\nNote that useradd will not create a home directory for such a user, regardless of the\ndefault setting in /etc/login.defs (CREATEHOME). You have to specify the -m options if\nyou want a home directory for a system account to be created.\n\nNote that this option will not update /etc/subuid and /etc/subgid. You have to specify\nthe -F options if you want to update the files for a system account to be created.\n",
                    "flag": "-r",
                    "long": "--system"
                },
                {
                    "name": "-R --root _",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory. Only absolute paths are supported.\n",
                    "flag": "-R",
                    "long": "--root"
                },
                {
                    "name": "-P --prefix _",
                    "content": "Apply changes to configuration files under the root filesystem found under the directory\nPREFIXDIR. This option does not chroot and is intended for preparing a cross-compilation\ntarget. Some limitations: NIS and LDAP users/groups are not verified. PAM authentication\nis using the host files. No SELINUX support.\n",
                    "flag": "-P",
                    "long": "--prefix"
                },
                {
                    "name": "-s --shell _",
                    "content": "sets the path to the user's login shell. Without this option, the system will use the\nSHELL variable specified in /etc/default/useradd, or, if that is as well not set, the\nfield for the login shell in /etc/passwd remains empty.\n",
                    "flag": "-s",
                    "long": "--shell"
                },
                {
                    "name": "-u --uid _",
                    "content": "The numerical value of the user's ID. This value must be unique, unless the -o option is\nused. The value must be non-negative. The default is to use the smallest ID value greater\nthan or equal to UIDMIN and greater than every other user.\n\nSee also the -r option and the UIDMAX description.\n",
                    "flag": "-u",
                    "long": "--uid"
                },
                {
                    "name": "-U --user-group",
                    "content": "Create a group with the same name as the user, and add the user to this group.\n\nThe default behavior (if the -g, -N, and -U options are not specified) is defined by the\nUSERGROUPSENAB variable in /etc/login.defs.\n",
                    "flag": "-U",
                    "long": "--user-group"
                },
                {
                    "name": "-Z --selinux-user _",
                    "content": "defines the SELinux user for the new account. Without this option, a SELinux uses the\ndefault user. Note that the shadow system doesn't store the selinux-user, it uses\nsemanage(8) for that.\n",
                    "flag": "-Z",
                    "long": "--selinux-user"
                },
                {
                    "name": "Changing the default values",
                    "content": "When invoked with only the -D option, useradd will display the current default values. When\ninvoked with -D plus other options, useradd will update the default values for the specified\noptions. Valid default-changing options are:\n"
                },
                {
                    "name": "-b --base-dir _",
                    "content": "sets the path prefix for a new user's home directory. The user's name will be affixed to\nthe end of BASEDIR to form the new user's home directory name, if the -d option is not\nused when creating a new account.\n\nThis option sets the HOME variable in /etc/default/useradd.\n",
                    "flag": "-b",
                    "long": "--base-dir"
                },
                {
                    "name": "-e --expiredate _",
                    "content": "sets the date on which newly created user accounts are disabled.\n\nThis option sets the EXPIRE variable in /etc/default/useradd.\n",
                    "flag": "-e",
                    "long": "--expiredate"
                },
                {
                    "name": "-f --inactive _",
                    "content": "defines the number of days after the password exceeded its maximum age where the user is\nexpected to replace this password. See shadow(5)for more information.\n\nThis option sets the INACTIVE variable in /etc/default/useradd.\n",
                    "flag": "-f",
                    "long": "--inactive"
                },
                {
                    "name": "-g --gid _",
                    "content": "sets the default primary group for newly created users, accepting group names or a\nnumerical group ID. The named group must exist, and the GID must have an existing entry.\n\nThis option sets the GROUP variable in /etc/default/useradd.\n",
                    "flag": "-g",
                    "long": "--gid"
                },
                {
                    "name": "-s --shell _",
                    "content": "defines the default login shell for new users.\n\nThis option sets the SHELL variable in /etc/default/useradd.\n",
                    "flag": "-s",
                    "long": "--shell"
                }
            ]
        },
        "NOTES": {
            "content": "The system administrator is responsible for placing the default user files in the /etc/skel/\ndirectory (or any other skeleton directory specified in /etc/default/useradd or on the\ncommand line).\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "You may not add a user to a NIS or LDAP group. This must be performed on the corresponding\nserver.\n\nSimilarly, if the username already exists in an external user database such as NIS or LDAP,\nuseradd will deny the user account creation request.\n\nUsernames may contain only lower and upper case letters, digits, underscores, or dashes. They\ncan end with a dollar sign. Dashes are not allowed at the beginning of the username. Fully\nnumeric usernames and usernames . or .. are also disallowed. It is not recommended to use\nusernames beginning with . character as their home directories will be hidden in the ls\noutput.\n\nOn Debian, the only constraints are that usernames must neither start with a dash ('-') nor\nplus ('+') nor tilde ('~') nor contain a colon (':'), a comma (','), or a whitespace (space:\n' ', end of line: '\\n', tabulation: '\\t', etc.). Note that using a slash ('/') may break the\ndefault algorithm for the definition of the user's home directory.\n\nOn Ubuntu, the same constraints as Debian are in place, with the additional constraint that\nthe username cannot be fully numeric. This includes octal and hexadecimal syntax.\n\nUsernames may only be up to 32 characters long.\n",
            "subsections": []
        },
        "CONFIGURATION": {
            "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
            "subsections": [
                {
                    "name": "CREATE_HOME (boolean)",
                    "content": "Indicate if a home directory should be created by default for new users.\n\nThis setting does not apply to system users, and can be overridden on the command line.\n"
                },
                {
                    "name": "GID_MAX (number), GID_MIN (number)",
                    "content": "Range of group IDs used for the creation of regular groups by useradd, groupadd, or\nnewusers.\n\nThe default value for GIDMIN (resp.  GIDMAX) is 1000 (resp. 60000).\n"
                },
                {
                    "name": "HOME_MODE (number)",
                    "content": "The mode for new home directories. If not specified, the UMASK is used to create the\nmode.\n\nuseradd and newusers use this to set the mode of the home directory they create.\n"
                },
                {
                    "name": "LASTLOG_UID_MAX (number)",
                    "content": "Highest user ID number for which the lastlog entries should be updated. As higher user\nIDs are usually tracked by remote user identity and authentication services there is no\nneed to create a huge sparse lastlog file for them.\n\nNo LASTLOGUIDMAX option present in the configuration means that there is no user ID\nlimit for writing lastlog entries.\n"
                },
                {
                    "name": "MAIL_DIR (string)",
                    "content": "The mail spool directory. This is needed to manipulate the mailbox when its corresponding\nuser account is modified or deleted. If not specified, a compile-time default is used.\nThe parameter CREATEMAILSPOOL in /etc/default/useradd determines whether the mail spool\nshould be created.\n"
                },
                {
                    "name": "MAIL_FILE (string)",
                    "content": "Defines the location of the users mail spool files relatively to their home directory.\n\nThe MAILDIR and MAILFILE variables are used by useradd, usermod, and userdel to create,\nmove, or delete the user's mail spool.\n"
                },
                {
                    "name": "MAX_MEMBERS_PER_GROUP (number)",
                    "content": "Maximum members per group entry. When the maximum is reached, a new group entry (line) is\nstarted in /etc/group (with the same name, same password, and same GID).\n\nThe default value is 0, meaning that there are no limits in the number of members in a\ngroup.\n\nThis feature (split group) permits to limit the length of lines in the group file. This\nis useful to make sure that lines for NIS groups are not larger than 1024 characters.\n\nIf you need to enforce such limit, you can use 25.\n\nNote: split groups may not be supported by all tools (even in the Shadow toolsuite). You\nshould not use this variable unless you really need it.\n"
                },
                {
                    "name": "PASS_MAX_DAYS (number)",
                    "content": "The maximum number of days a password may be used. If the password is older than this, a\npassword change will be forced. If not specified, -1 will be assumed (which disables the\nrestriction).\n"
                },
                {
                    "name": "PASS_MIN_DAYS (number)",
                    "content": "The minimum number of days allowed between password changes. Any password changes\nattempted sooner than this will be rejected. If not specified, 0 will be assumed (which\ndisables the restriction).\n"
                },
                {
                    "name": "PASS_WARN_AGE (number)",
                    "content": "The number of days warning given before a password expires. A zero means warning is given\nonly upon the day of expiration, a negative value means no warning is given. If not\nspecified, no warning will be provided.\n"
                },
                {
                    "name": "SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)",
                    "content": "If /etc/subuid exists, the commands useradd and newusers (unless the user already have\nsubordinate group IDs) allocate SUBGIDCOUNT unused group IDs from the range SUBGIDMIN\nto SUBGIDMAX for each new user.\n\nThe default values for SUBGIDMIN, SUBGIDMAX, SUBGIDCOUNT are respectively 100000,\n600100000 and 65536.\n"
                },
                {
                    "name": "SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)",
                    "content": "If /etc/subuid exists, the commands useradd and newusers (unless the user already have\nsubordinate user IDs) allocate SUBUIDCOUNT unused user IDs from the range SUBUIDMIN\nto SUBUIDMAX for each new user.\n\nThe default values for SUBUIDMIN, SUBUIDMAX, SUBUIDCOUNT are respectively 100000,\n600100000 and 65536.\n"
                },
                {
                    "name": "SYS_GID_MAX (number), SYS_GID_MIN (number)",
                    "content": "Range of group IDs used for the creation of system groups by useradd, groupadd, or\nnewusers.\n\nThe default value for SYSGIDMIN (resp.  SYSGIDMAX) is 101 (resp.  GIDMIN-1).\n"
                },
                {
                    "name": "SYS_UID_MAX (number), SYS_UID_MIN (number)",
                    "content": "Range of user IDs used for the creation of system users by useradd or newusers.\n\nThe default value for SYSUIDMIN (resp.  SYSUIDMAX) is 101 (resp.  UIDMIN-1).\n"
                },
                {
                    "name": "UID_MAX (number), UID_MIN (number)",
                    "content": "Range of user IDs used for the creation of regular users by useradd or newusers.\n\nThe default value for UIDMIN (resp.  UIDMAX) is 1000 (resp. 60000).\n"
                },
                {
                    "name": "UMASK (number)",
                    "content": "The file mode creation mask is initialized to this value. If not specified, the mask will\nbe initialized to 022.\n\nuseradd and newusers use this mask to set the mode of the home directory they create if\nHOMEMODE is not set.\n\nIt is also used by pamumask as the default umask value.\n"
                },
                {
                    "name": "USERGROUPS_ENAB (boolean)",
                    "content": "If set to yes, userdel will remove the user's group if it contains no more members, and\nuseradd will create by default a group with the name of the user.\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/passwd\nUser account information.\n\n/etc/shadow\nSecure user account information.\n\n/etc/group\nGroup account information.\n\n/etc/gshadow\nSecure group account information.\n\n/etc/default/useradd\nDefault values for account creation.\n\n/etc/shadow-maint/useradd-pre.d/*, /etc/shadow-maint/useradd-post.d/*\nRun-part files to execute during user addition. The environment variable ACTION will be\npopulated with useradd and SUBJECT with the username.  useradd-pre.d will be executed\nprior to any user addition.  useradd-post.d will execute after user addition. If a script\nexits non-zero then execution will terminate.\n\n/etc/skel/\nDirectory containing default files.\n\n/etc/subgid\nPer user subordinate group IDs.\n\n/etc/subuid\nPer user subordinate user IDs.\n\n/etc/login.defs\nShadow password suite configuration.\n",
            "subsections": []
        },
        "EXIT VALUES": {
            "content": "The useradd command exits with the following values:\n\n0\nsuccess\n\n1\ncan't update password file\n\n2\ninvalid command syntax\n\n3\ninvalid argument to option\n\n4\nUID already in use (and no -o)\n\n6\nspecified group doesn't exist\n\n9\nusername or group name already in use\n\n10\ncan't update group file\n\n12\ncan't create home directory\n\n14\ncan't update SELinux user mapping\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chfn(1), chsh(1), passwd(1), crypt(3), groupadd(8), groupdel(8), groupmod(8), login.defs(5),\nnewusers(8), subgid(5), subuid(5), userdel(8), usermod(8).\n\nshadow-utils 4.13                            05/30/2024                                   USERADD(8)",
            "subsections": []
        }
    },
    "summary": "useradd - create a new user or update default new user information",
    "flags": [
        {
            "flag": "",
            "long": "--badname",
            "arg": null,
            "description": "Allow names that do not conform to standards."
        },
        {
            "flag": "-b",
            "long": "--base-dir",
            "arg": null,
            "description": "The default base directory for the system if -d HOMEDIR is not specified. BASEDIR is concatenated with the account name to define the home directory. If this option is not specified, useradd will use the base directory specified by the HOME variable in /etc/default/useradd, or /home by default."
        },
        {
            "flag": "-c",
            "long": "--comment",
            "arg": null,
            "description": "Any text string. It is generally a short description of the account, and is currently used as the field for the user's full name."
        },
        {
            "flag": "-d",
            "long": "--home-dir",
            "arg": null,
            "description": "The new user will be created using HOMEDIR as the value for the user's login directory. The default is to append the LOGIN name to BASEDIR and use that as the login directory name. If the directory HOMEDIR does not exist, then it will be created unless the -M option is specified."
        },
        {
            "flag": "-D",
            "long": "--defaults",
            "arg": null,
            "description": "See below, the subsection \"Changing the default values\"."
        },
        {
            "flag": "-e",
            "long": "--expiredate",
            "arg": null,
            "description": "The date on which the user account will be disabled. The date is specified in the format YYYY-MM-DD. If not specified, useradd will use the default expiry date specified by the EXPIRE variable in /etc/default/useradd, or an empty string (no expiry) by default."
        },
        {
            "flag": "-f",
            "long": "--inactive",
            "arg": null,
            "description": "defines the number of days after the password exceeded its maximum age where the user is expected to replace this password. The value is stored in the shadow password file. An input of 0 will disable an expired password with no delay. An input of -1 will blank the respective field in the shadow password file. See shadow(5)for more information. If not specified, useradd will use the default inactivity period specified by the INACTIVE variable in /etc/default/useradd, or -1 by default."
        },
        {
            "flag": "-F",
            "long": "--add-subids-for-system",
            "arg": null,
            "description": "Update /etc/subuid and /etc/subgid even when creating a system account with -r option."
        },
        {
            "flag": "-g",
            "long": "--gid",
            "arg": null,
            "description": "The name or the number of the user's primary group. The group name must exist. A group number must refer to an already existing group. If not specified, the behavior of useradd will depend on the USERGROUPSENAB variable in /etc/login.defs. If this variable is set to yes (or -U/--user-group is specified on the command line), a group will be created for the user, with the same name as her loginname. If the variable is set to no (or -N/--no-user-group is specified on the command line), useradd will set the primary group of the new user to the value specified by the GROUP variable in /etc/default/useradd, or 100 by default."
        },
        {
            "flag": "-G",
            "long": "--groups",
            "arg": null,
            "description": "A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option. The default is for the user to belong only to the initial group."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-k",
            "long": "--skel",
            "arg": null,
            "description": "The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd. This option is only valid if the -m (or --create-home) option is specified. If this option is not set, the skeleton directory is defined by the SKEL variable in /etc/default/useradd or, by default, /etc/skel. If possible, the ACLs and extended attributes are copied."
        },
        {
            "flag": "-K",
            "long": "--key",
            "arg": null,
            "description": "Overrides /etc/login.defs defaults (UIDMIN, UIDMAX, UMASK, PASSMAXDAYS and others). Example: -K PASSMAXDAYS =-1 can be used when creating an account to turn off password aging. Multiple -K options can be specified, e.g.: -K UIDMIN =100 -K UIDMAX=499 For the compatibility with previous Debian's useradd, the -O option is also supported."
        },
        {
            "flag": "-l",
            "long": "--no-log-init",
            "arg": null,
            "description": "Do not add the user to the lastlog and faillog databases. By default, the user's entries in the lastlog and faillog databases are reset to avoid reusing the entry from a previously deleted user. If this option is not specified, useradd will also consult the variable LOGINIT in the /etc/default/useradd if set to no the user will not be added to the lastlog and faillog databases."
        },
        {
            "flag": "-m",
            "long": "--create-home",
            "arg": null,
            "description": "Create the user's home directory if it does not exist. The files and directories contained in the skeleton directory (which can be defined with the -k option) will be copied to the home directory. By default, if this option is not specified and CREATEHOME is not enabled, no home directories are created. The directory where the user's home directory is created must exist and have proper SELinux context and permissions. Otherwise the user's home directory cannot be created or accessed."
        },
        {
            "flag": "-M",
            "long": "--no-create-home",
            "arg": null,
            "description": "Do not create the user's home directory, even if the system wide setting from /etc/login.defs (CREATEHOME) is set to yes."
        },
        {
            "flag": "-N",
            "long": "--no-user-group",
            "arg": null,
            "description": "Do not create a group with the same name as the user, but add the user to the group specified by the -g option or by the GROUP variable in /etc/default/useradd. The default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPSENAB variable in /etc/login.defs."
        },
        {
            "flag": "-o",
            "long": "--non-unique",
            "arg": null,
            "description": "allows the creation of an account with an already existing UID. This option is only valid in combination with the -u option. As a user identity serves as key to map between users on one hand and permissions, file ownerships and other aspects that determine the system's behavior on the other hand, more than one login name will access the account of the given UID."
        },
        {
            "flag": "-p",
            "long": "--password",
            "arg": null,
            "description": "defines an initial password for the account. PASSWORD is expected to be encrypted, as returned by crypt (3). Within a shell script, this option allows to create efficiently batches of users. Without this option, the new account will be locked and with no password defined, i.e. a single exclamation mark in the respective field of /etc/shadow. This is a state where the user won't be able to access the account or to define a password himself. Note:Avoid this option on the command line because the password (or encrypted password) will be visible by users listing the processes. You should make sure the password respects the system's password policy."
        },
        {
            "flag": "-r",
            "long": "--system",
            "arg": null,
            "description": "Create a system account. System users will be created with no aging information in /etc/shadow, and their numeric identifiers are chosen in the SYSUIDMIN-SYSUIDMAX range, defined in /etc/login.defs, instead of UIDMIN-UIDMAX (and their GID counterparts for the creation of groups). Note that useradd will not create a home directory for such a user, regardless of the default setting in /etc/login.defs (CREATEHOME). You have to specify the -m options if you want a home directory for a system account to be created. Note that this option will not update /etc/subuid and /etc/subgid. You have to specify the -F options if you want to update the files for a system account to be created."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory. Only absolute paths are supported."
        },
        {
            "flag": "-P",
            "long": "--prefix",
            "arg": null,
            "description": "Apply changes to configuration files under the root filesystem found under the directory PREFIXDIR. This option does not chroot and is intended for preparing a cross-compilation target. Some limitations: NIS and LDAP users/groups are not verified. PAM authentication is using the host files. No SELINUX support."
        },
        {
            "flag": "-s",
            "long": "--shell",
            "arg": null,
            "description": "sets the path to the user's login shell. Without this option, the system will use the SHELL variable specified in /etc/default/useradd, or, if that is as well not set, the field for the login shell in /etc/passwd remains empty."
        },
        {
            "flag": "-u",
            "long": "--uid",
            "arg": null,
            "description": "The numerical value of the user's ID. This value must be unique, unless the -o option is used. The value must be non-negative. The default is to use the smallest ID value greater than or equal to UIDMIN and greater than every other user. See also the -r option and the UIDMAX description."
        },
        {
            "flag": "-U",
            "long": "--user-group",
            "arg": null,
            "description": "Create a group with the same name as the user, and add the user to this group. The default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPSENAB variable in /etc/login.defs."
        },
        {
            "flag": "-Z",
            "long": "--selinux-user",
            "arg": null,
            "description": "defines the SELinux user for the new account. Without this option, a SELinux uses the default user. Note that the shadow system doesn't store the selinux-user, it uses semanage(8) for that."
        },
        {
            "flag": "-b",
            "long": "--base-dir",
            "arg": null,
            "description": "sets the path prefix for a new user's home directory. The user's name will be affixed to the end of BASEDIR to form the new user's home directory name, if the -d option is not used when creating a new account. This option sets the HOME variable in /etc/default/useradd."
        },
        {
            "flag": "-e",
            "long": "--expiredate",
            "arg": null,
            "description": "sets the date on which newly created user accounts are disabled. This option sets the EXPIRE variable in /etc/default/useradd."
        },
        {
            "flag": "-f",
            "long": "--inactive",
            "arg": null,
            "description": "defines the number of days after the password exceeded its maximum age where the user is expected to replace this password. See shadow(5)for more information. This option sets the INACTIVE variable in /etc/default/useradd."
        },
        {
            "flag": "-g",
            "long": "--gid",
            "arg": null,
            "description": "sets the default primary group for newly created users, accepting group names or a numerical group ID. The named group must exist, and the GID must have an existing entry. This option sets the GROUP variable in /etc/default/useradd."
        },
        {
            "flag": "-s",
            "long": "--shell",
            "arg": null,
            "description": "defines the default login shell for new users. This option sets the SHELL variable in /etc/default/useradd."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "chfn",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chfn/1/json"
        },
        {
            "name": "chsh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chsh/1/json"
        },
        {
            "name": "passwd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/1/json"
        },
        {
            "name": "crypt",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/crypt/3/json"
        },
        {
            "name": "groupadd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupadd/8/json"
        },
        {
            "name": "groupdel",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupdel/8/json"
        },
        {
            "name": "groupmod",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/groupmod/8/json"
        },
        {
            "name": "login.defs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
        },
        {
            "name": "newusers",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/newusers/8/json"
        },
        {
            "name": "subgid",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/subgid/5/json"
        },
        {
            "name": "subuid",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/subuid/5/json"
        },
        {
            "name": "userdel",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/userdel/8/json"
        },
        {
            "name": "usermod",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/usermod/8/json"
        }
    ]
}