USERADD(8) System Management Commands USERADD(8) NNAAMMEE useradd - Create a new user or update default new user information SSYYNNOOPPSSIISS uusseerraadddd [_o_p_t_i_o_n_s] _L_O_G_I_N uusseerraadddd -D uusseerraadddd -D [_o_p_t_i_o_n_s] DDEESSCCRRIIPPTTIIOONN When invoked without the --DD option, the uusseerraadddd command creates a new user account using the values specified on the command line and the default values from the system. Depending on command line options, the useradd command will update system files and may also create the new user’s home directory and copy initial files. The version provided with Red Hat Linux will create a group for each user added to the system by default. OOPPTTIIOONNSS The options which apply to the uusseerraadddd command are: --cc, ----ccoommmmeenntt _C_O_M_M_E_N_T Any text string. It is generally a short description of the login, and is currently used as the field for the user’s full name. --bb, ----bbaassee--ddiirr _B_A_S_E___D_I_R The default base directory for the system if --dd dir is not specified. _B_A_S_E___D_I_R is concatenated with the account name to define the home directory. If the --mm option is not used, base_dir must exist. --dd, ----hhoommee _H_O_M_E___D_I_R The new user will be created using _H_O_M_E___D_I_R as the value for the user’s login directory. The default is to append the _L_O_G_I_N name to _B_A_S_E___D_I_R and use that as the login directory name. --ee, ----eexxppiirreeddaattee _E_X_P_I_R_E___D_A_T_E The date on which the user account will be disabled. The date is specified in the format _Y_Y_Y_Y_-_M_M_-_D_D. --ff, ----iinnaaccttiivvee _I_N_A_C_T_I_V_E The number of days after a password expires until the account is permanently disabled. A value of 0 disables the account as soon as the password has expired, and a value of -1 disables the feature. The default value is -1. --gg, ----ggiidd _G_R_O_U_P The group name or number of the user’s initial login group. The group name must exist. A group number must refer to an already existing group. --GG, ----ggrroouuppss _G_R_O_U_P_1[_,_G_R_O_U_P_2_,_._._.[_,_G_R_O_U_P_N]]] 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 --gg option. The default is for the user to belong only to the initial group. --hh, ----hheellpp Display help message and exit. --MM The user’s home directory will not be created, even if the system wide settings from _/_e_t_c_/_l_o_g_i_n_._d_e_f_s is to create home dirs. --mm, ----ccrreeaattee--hhoommee The user’s home directory will be created if it does not exist. The files contained in _S_K_E_L___D_I_R will be copied to the home directory if the --kk option is used, otherwise the files contained in _/_e_t_c_/_s_k_e_l will be used instead. Any directories contained in _S_K_E_L___D_I_R or _/_e_t_c_/_s_k_e_l will be created in the user’s home directory as well. The --kk option is only valid in conjunction with the --mm option. The default is to not create the directory and to not copy any files. --ll Do not add the user to the last login log file. This is an option added by Red Hat. --nn A group having the same name as the user being added to the system will be created by default. This option will turn off this Red Hat Linux specific behavior. When this option is used, users by default will be placed in whatever group is specified in _/_e_t_c_/_d_e_f_a_u_l_t_/_u_s_e_r_a_d_d. If no default group is defined, group 1 will be used. --KK, ----kkeeyy _K_E_Y=_V_A_L_U_E Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK, PASS_MAX_DAYS and others). Example: --KK _P_A_S_S___M_A_X___D_A_Y_S=_-_1 can be used when creating system account to turn off password ageing, even though system account has no password at all. Multiple --KK options can be specified, e.g.: --KK _U_I_D___M_I_N=_1_0_0 --KK _U_I_D___M_A_X=_4_9_9 Note: --KK _U_I_D___M_I_N=_1_0,_U_I_D___M_A_X=_4_9_9 doesn’t work yet. --oo, ----nnoonn--uunniiqquuee Allow create user account with duplicate (non-unique) UID. --pp, ----ppaasssswwoorrdd _P_A_S_S_W_O_R_D The encrypted password, as returned by ccrryypptt(3). The default is to disable the account. --rr This flag is used to create a system account. That is, a user with a UID lower than the value of UID_MIN defined in _/_e_t_c_/_l_o_g_i_n_._d_e_f_s and whose password does not expire. Note that uusseerraadddd will not create a home directory for such an user, regardless of the default setting in _/_e_t_c_/_l_o_g_i_n_._d_e_f_s. You have to specify --mm option if you want a home directory for a system account to be created. This is an option added by Red Hat --ss, ----sshheellll _S_H_E_L_L The name of the user’s login shell. The default is to leave this field blank, which causes the system to select the default login shell. --uu, ----uuiidd _U_I_D The numerical value of the user’s ID. This value must be unique, unless the --oo option is used. The value must be non-negative. The default is to use the smallest ID value greater than 999 and greater than every other user. Values between 0 and 999 are typically reserved for system accounts. CChhaannggiinngg tthhee ddeeffaauulltt vvaalluueess When invoked with the --DD option, uusseerraadddd will either display the current default values, or update the default values from the command line. The valid options are --bb _H_O_M_E___D_I_R The initial path prefix for a new user’s home directory. The user’s name will be affixed to the end of _H_O_M_E___D_I_R to create the new directory name if the --dd option is not used when creating a new account. --ee _E_X_P_I_R_E___D_A_T_E The date on which the user account is disabled. --ff _I_N_A_C_T_I_V_E The number of days after a password has expired before the account will be disabled. --gg, ----ggiidd _G_R_O_U_P The group name or ID for a new user’s initial group. The named group must exist, and a numerical group ID must have an existing entry. --ss, ----sshheellll _S_H_E_L_L The name of the new user’s login shell. The named program will be used for all future new user accounts. If no options are specified, uusseerraadddd displays the current default values. NNOOTTEESS The system administrator is responsible for placing the default user files in the _/_e_t_c_/_s_k_e_l_/ directory. This version of useradd was modified by Red Hat to suit Red Hat user/group conventions. CCAAVVEEAATTSS You may not add a user to a NIS group. This must be performed on the NIS server. Similarly, if the username already exists in an external user database such as NIS, uusseerraadddd will deny the user account creation request. FFIILLEESS _/_e_t_c_/_p_a_s_s_w_d user account information _/_e_t_c_/_s_h_a_d_o_w secure user account information _/_e_t_c_/_g_r_o_u_p group account information _/_e_t_c_/_g_s_h_a_d_o_w secure group information _/_e_t_c_/_d_e_f_a_u_l_t_/_u_s_e_r_a_d_d default information _/_e_t_c_/_l_o_g_i_n_._d_e_f_s system-wide settings _/_e_t_c_/_s_k_e_l_/ directory containing default files _/_e_t_c_/_l_o_g_i_n_._d_e_f_s shadow password suite configuration EEXXIITT VVAALLUUEESS The uusseerraadddd command exits with the following values: _0 success _1 can’t update password file _2 invalid command syntax _3 invalid argument to option _4 UID already in use (and no --oo) _6 specified group doesn’t exist _9 username already in use _1_0 can’t update group file _1_2 can’t create home directory _1_3 can’t create mail spool SSEEEE AALLSSOO cchhffnn(1), cchhsshh(1), ppaasssswwdd(1), ccrryypptt(3), ggrroouuppaadddd(8), ggrroouuppddeell(8), ggrroouuppmmoodd(8), llooggiinn..ddeeffss(5), uusseerrddeell(8), uusseerrmmoodd(8). System Management Commands 01/02/2006 USERADD(8)