Linux "newusers" Command Line Options and Examples
update and create new users in batch

The newusers command reads a file (or the standard input by default) and uses this information to update a set of existing users or to create new users.


Usage:

newusers [options] [file]






Command Line Options:

-h
Display help message and exit.
newusers -h ...
-r
Create a system account.System users will be created with no aging information in /etc/shadow, and their numeric identifiers are chosen in theSYS_UID_MIN-SYS_UID_MAX range, defined in login.defs, instead of UID_MIN-UID_MAX (and their GID counterparts for the creation ofgroups).
newusers -r ...
-R
Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.CAVEATSThe input file must be protected since it contains unencrypted passwords.CONFIGURATIONThe following configuration variables in /etc/login.defs change the behavior of this tool:GID_MAX (number), GID_MIN (number)Range of group IDs used for the creation of regular groups by useradd, groupadd, or newusers.The default value for GID_MIN (resp. GID_MAX) is 1000 (resp. 60000).MAX_MEMBERS_PER_GROUP (number)Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in /etc/group (with the samename, same password, and same GID).The default value is 0, meaning that there are no limits in the number of members in a group.This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NISgroups are not larger than 1024 characters.If you need to enforce such limit, you can use 25.Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless youreally need it.PASS_MAX_DAYS (number)The maximum number of days a password may be used. If the password is older than this, a password change will be forced. If notspecified, -1 will be assumed (which disables the restriction).PASS_MIN_DAYS (number)The minimum number of days allowed between password changes. Any password changes attempted sooner than this will be rejected. Ifnot specified, -1 will be assumed (which disables the restriction).PASS_WARN_AGE (number)The number of days warning given before a password expires. A zero means warning is given only upon the day of expiration, anegative value means no warning is given. If not specified, no warning will be provided.SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)If /etc/subuid exists, the commands useradd and newusers (unless the user already have subordinate group IDs) allocateSUB_GID_COUNT unused group IDs from the range SUB_GID_MIN to SUB_GID_MAX for each new user.The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are respectively 100000, 600100000 and 10000.SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)If /etc/subuid exists, the commands useradd and newusers (unless the user already have subordinate user IDs) allocateSUB_UID_COUNT unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each new user.The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are respectively 100000, 600100000 and 10000.SYS_GID_MAX (number), SYS_GID_MIN (number)Range of group IDs used for the creation of system groups by useradd, groupadd, or newusers.The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101 (resp. GID_MIN-1).SYS_UID_MAX (number), SYS_UID_MIN (number)Range of user IDs used for the creation of system users by useradd or newusers.The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101 (resp. UID_MIN-1).UID_MAX (number), UID_MIN (number)Range of user IDs used for the creation of regular users by useradd or newusers.The default value for UID_MIN (resp. UID_MAX) is 1000 (resp. 60000).UMASK (number)The file mode creation mask is initialized to this value. If not specified, the mask will be initialized to 022.useradd and newusers use this mask to set the mode of the home directory they createIt is also used by pam_umask as the default umask value.FILES/etc/passwdUser account information./etc/shadowSecure user account information./etc/groupGroup account information./etc/gshadowSecure group account information./etc/login.defsShadow password suite configuration./etc/pam.d/newusersPAM configuration for newusers./etc/subgidPer user subordinate group IDs./etc/subuidPer user subordinate user IDs.
newusers -R ...