Definition:

  • create a new user or update default new user information
  • when user has no running processes
  • Behaviours also effected by /etc/login.defs
  • Admin should usually use adduser command instead.

Synopsis:

  • useradd [options] LOGIN
    • LOGIN is the username

List of options:

  • -c, --comment COMMENT
    • comment value
  • -d, --home-dir HOME_DIR
    • home directory of the new account
  • -e, --expiredate EXPIRE_DATE
    • Set an expiration date for the user account, format YYYY-MM-DD
    • -m, --create-home
      • 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 CREATE_HOME is not enabled, no home directories are created.
  • -s, --shell SHELL
    • login shell of the new account
  • -u, --uid UID
    • user ID of the new account
Changing the default values
  • When invoked with only the -D option, useradd will display the current default values.
  • When invoked with -D plus other options, useradd will update the default values for the specified options. Valid default-changing options are: