man-pages/man8/newusers.8.html
2021-03-31 01:06:50 +01:00

482 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of NEWUSERS</TITLE>
</HEAD><BODY>
<H1>NEWUSERS</H1>
Section: System Management Commands (8)<BR>Updated: 05/28/2020<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
newusers - update and create new users in batch
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<DL COMPACT>
<DT id="1">
<B>newusers</B> [<I>options</I>] [<I>file</I>]
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<DD>The
<B>newusers</B>
command reads a
<I>file</I>
(or the standard input by default) and uses this information to update a set of existing users or to create new users. Each line is in the same format as the standard password file (see
<B><A HREF="/cgi-bin/man/man2html?5+passwd">passwd</A></B>(5)) with the exceptions explained below:
<P>
pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell
<P>
<I>pw_name</I>
<DL COMPACT><DT id="2"><DD>
This is the name of the user.
<P>
It can be the name of a new user or the name of an existing user (or a user created before by
<B>newusers</B>). In case of an existing user, the user's information will be changed, otherwise a new user will be created.
</DL>
<P>
<I>pw_passwd</I>
<DL COMPACT><DT id="3"><DD>
This field will be encrypted and used as the new value of the encrypted password.
</DL>
<P>
<I>pw_uid</I>
<DL COMPACT><DT id="4"><DD>
This field is used to define the UID of the user.
<P>
If the field is empty, a new (unused) UID will be defined automatically by
<B>newusers</B>.
<P>
If this field contains a number, this number will be used as the UID.
<P>
If this field contains the name of an existing user (or the name of a user created before by
<B>newusers</B>), the UID of the specified user will be used.
<P>
If the UID of an existing user is changed, the files ownership of the user's file should be fixed manually.
</DL>
<P>
<I>pw_gid</I>
<DL COMPACT><DT id="5"><DD>
This field is used to define the primary group ID for the user.
<P>
If this field contains the name of an existing group (or a group created before by
<B>newusers</B>), the GID of this group will be used as the primary group ID for the user.
<P>
If this field is a number, this number will be used as the primary group ID of the user. If no groups exist with this GID, a new group will be created with this GID, and the name of the user.
<P>
If this field is empty, a new group will be created with the name of the user and a GID will be automatically defined by
<B>newusers</B>
to be used as the primary group ID for the user and as the GID for the new group.
<P>
If this field contains the name of a group which does not exist (and was not created before by
<B>newusers</B>), a new group will be created with the specified name and a GID will be automatically defined by
<B>newusers</B>
to be used as the primary group ID for the user and GID for the new group.
</DL>
<P>
<I>pw_gecos</I>
<DL COMPACT><DT id="6"><DD>
This field is copied in the GECOS field of the user.
</DL>
<P>
<I>pw_dir</I>
<DL COMPACT><DT id="7"><DD>
This field is used to define the home directory of the user.
<P>
If this field does not specify an existing directory, the specified directory is created, with ownership set to the user being created or updated and its primary group.
<P>
If the home directory of an existing user is changed,
<B>newusers</B>
does not move or copy the content of the old directory to the new location. This should be done manually.
</DL>
<P>
<I>pw_shell</I>
<DL COMPACT><DT id="8"><DD>
This field defines the shell of the user. No checks are performed on this field.
</DL>
<P>
<B>newusers</B>
first tries to create or change all the specified users, and then write these changes to the user or group databases. If an error occurs (except in the final writes to the databases), no changes are committed to the databases.
<P>
During this first pass, users are created with a locked password (and passwords are not changed for the users which are not created). A second pass is used to update the passwords using PAM. Failures to update a password are reported, but will not stop the other password updates.
<P>
This command is intended to be used in a large system environment where many accounts are updated at a single time.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
The options which apply to the
<B>newusers</B>
command are:
<P>
<B>--badname</B>&nbsp;
<DL COMPACT><DT id="9"><DD>
Allow names that do not conform to standards.
</DL>
<P>
<B>-h</B>, <B>--help</B>
<DL COMPACT><DT id="10"><DD>
Display help message and exit.
</DL>
<P>
<B>-r</B>, <B>--system</B>
<DL COMPACT><DT id="11"><DD>
Create a system account.
<P>
System users will be created with no aging information in
/etc/shadow, and their numeric identifiers are chosen in the
<B>SYS_UID_MIN</B>-<B>SYS_UID_MAX</B>
range, defined in
login.defs, instead of
<B>UID_MIN</B>-<B>UID_MAX</B>
(and their
<B>GID</B>
counterparts for the creation of groups).
</DL>
<P>
<B>-R</B>, <B>--root</B>&nbsp;<I>CHROOT_DIR</I>
<DL COMPACT><DT id="12"><DD>
Apply changes in the
<I>CHROOT_DIR</I>
directory and use the configuration files from the
<I>CHROOT_DIR</I>
directory.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>CAVEATS</H2>
<P>
The input file must be protected since it contains unencrypted passwords.
<A NAME="lbAG">&nbsp;</A>
<H2>CONFIGURATION</H2>
<P>
The following configuration variables in
/etc/login.defs
change the behavior of this tool:
<P>
<B>GID_MAX</B> (number), <B>GID_MIN</B> (number)
<DL COMPACT><DT id="13"><DD>
Range of group IDs used for the creation of regular groups by
<B>useradd</B>,
<B>groupadd</B>, or
<B>newusers</B>.
<P>
The default value for
<B>GID_MIN</B>
(resp.
<B>GID_MAX</B>) is 1000 (resp. 60000).
</DL>
<P>
<B>HOME_MODE</B> (number)
<DL COMPACT><DT id="14"><DD>
The mode for new home directories. If not specified, the
<B>UMASK</B>
is used to create the mode.
<P>
<B>useradd</B>
and
<B>newusers</B>
use this to set the mode of the home directory they create.
</DL>
<P>
<B>MAX_MEMBERS_PER_GROUP</B> (number)
<DL COMPACT><DT id="15"><DD>
Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in
/etc/group
(with the same name, same password, and same GID).
<P>
The default value is 0, meaning that there are no limits in the number of members in a group.
<P>
This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NIS groups are not larger than 1024 characters.
<P>
If you need to enforce such limit, you can use 25.
<P>
Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you really need it.
</DL>
<P>
<B>PASS_MAX_DAYS</B> (number)
<DL COMPACT><DT id="16"><DD>
The maximum number of days a password may be used. If the password is older than this, a password change will be forced. If not specified, -1 will be assumed (which disables the restriction).
</DL>
<P>
<B>PASS_MIN_DAYS</B> (number)
<DL COMPACT><DT id="17"><DD>
The minimum number of days allowed between password changes. Any password changes attempted sooner than this will be rejected. If not specified, -1 will be assumed (which disables the restriction).
</DL>
<P>
<B>PASS_WARN_AGE</B> (number)
<DL COMPACT><DT id="18"><DD>
The number of days warning given before a password expires. A zero means warning is given only upon the day of expiration, a negative value means no warning is given. If not specified, no warning will be provided.
</DL>
<P>
<B>SUB_GID_MIN</B> (number), <B>SUB_GID_MAX</B> (number), <B>SUB_GID_COUNT</B> (number)
<DL COMPACT><DT id="19"><DD>
If
/etc/subuid
exists, the commands
<B>useradd</B>
and
<B>newusers</B>
(unless the user already have subordinate group IDs) allocate
<B>SUB_GID_COUNT</B>
unused group IDs from the range
<B>SUB_GID_MIN</B>
to
<B>SUB_GID_MAX</B>
for each new user.
<P>
The default values for
<B>SUB_GID_MIN</B>,
<B>SUB_GID_MAX</B>,
<B>SUB_GID_COUNT</B>
are respectively 100000, 600100000 and 65536.
</DL>
<P>
<B>SUB_UID_MIN</B> (number), <B>SUB_UID_MAX</B> (number), <B>SUB_UID_COUNT</B> (number)
<DL COMPACT><DT id="20"><DD>
If
/etc/subuid
exists, the commands
<B>useradd</B>
and
<B>newusers</B>
(unless the user already have subordinate user IDs) allocate
<B>SUB_UID_COUNT</B>
unused user IDs from the range
<B>SUB_UID_MIN</B>
to
<B>SUB_UID_MAX</B>
for each new user.
<P>
The default values for
<B>SUB_UID_MIN</B>,
<B>SUB_UID_MAX</B>,
<B>SUB_UID_COUNT</B>
are respectively 100000, 600100000 and 65536.
</DL>
<P>
<B>SYS_GID_MAX</B> (number), <B>SYS_GID_MIN</B> (number)
<DL COMPACT><DT id="21"><DD>
Range of group IDs used for the creation of system groups by
<B>useradd</B>,
<B>groupadd</B>, or
<B>newusers</B>.
<P>
The default value for
<B>SYS_GID_MIN</B>
(resp.
<B>SYS_GID_MAX</B>) is 101 (resp.
<B>GID_MIN</B>-1).
</DL>
<P>
<B>SYS_UID_MAX</B> (number), <B>SYS_UID_MIN</B> (number)
<DL COMPACT><DT id="22"><DD>
Range of user IDs used for the creation of system users by
<B>useradd</B>
or
<B>newusers</B>.
<P>
The default value for
<B>SYS_UID_MIN</B>
(resp.
<B>SYS_UID_MAX</B>) is 101 (resp.
<B>UID_MIN</B>-1).
</DL>
<P>
<B>UID_MAX</B> (number), <B>UID_MIN</B> (number)
<DL COMPACT><DT id="23"><DD>
Range of user IDs used for the creation of regular users by
<B>useradd</B>
or
<B>newusers</B>.
<P>
The default value for
<B>UID_MIN</B>
(resp.
<B>UID_MAX</B>) is 1000 (resp. 60000).
</DL>
<P>
<B>UMASK</B> (number)
<DL COMPACT><DT id="24"><DD>
The file mode creation mask is initialized to this value. If not specified, the mask will be initialized to 022.
<P>
<B>useradd</B>
and
<B>newusers</B>
use this mask to set the mode of the home directory they create if
<B>HOME_MODE</B>
is not set.
<P>
It is also used by
<B>pam_umask</B>
as the default umask value.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>FILES</H2>
<P>
/etc/passwd
<DL COMPACT><DT id="25"><DD>
User account information.
</DL>
<P>
/etc/shadow
<DL COMPACT><DT id="26"><DD>
Secure user account information.
</DL>
<P>
/etc/group
<DL COMPACT><DT id="27"><DD>
Group account information.
</DL>
<P>
/etc/gshadow
<DL COMPACT><DT id="28"><DD>
Secure group account information.
</DL>
<P>
/etc/login.defs
<DL COMPACT><DT id="29"><DD>
Shadow password suite configuration.
</DL>
<P>
/etc/pam.d/newusers
<DL COMPACT><DT id="30"><DD>
PAM configuration for
<B>newusers</B>.
</DL>
<P>
/etc/subgid
<DL COMPACT><DT id="31"><DD>
Per user subordinate group IDs.
</DL>
<P>
/etc/subuid
<DL COMPACT><DT id="32"><DD>
Per user subordinate user IDs.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?5+login.defs">login.defs</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?1+passwd">passwd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+subgid">subgid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+subuid">subuid</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?8+useradd">useradd</A></B>(8).
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="33"><A HREF="#lbAB">NAME</A><DD>
<DT id="34"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="35"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="36"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="37"><A HREF="#lbAF">CAVEATS</A><DD>
<DT id="38"><A HREF="#lbAG">CONFIGURATION</A><DD>
<DT id="39"><A HREF="#lbAH">FILES</A><DD>
<DT id="40"><A HREF="#lbAI">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:14 GMT, March 31, 2021
</BODY>
</HTML>