1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 1991 - 1994, Julianne Frances Haugh
4 Copyright (c) 2007 - 2009, Nicolas François
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. The name of the copyright holders or contributors may not be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
32 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
33 <!ENTITY ENCRYPT_METHOD SYSTEM "login.defs.d/ENCRYPT_METHOD.xml">
34 <!ENTITY GID_MAX SYSTEM "login.defs.d/GID_MAX.xml">
35 <!ENTITY MAX_MEMBERS_PER_GROUP SYSTEM "login.defs.d/MAX_MEMBERS_PER_GROUP.xml">
36 <!ENTITY MD5_CRYPT_ENAB SYSTEM "login.defs.d/MD5_CRYPT_ENAB.xml">
37 <!ENTITY PASS_MAX_DAYS SYSTEM "login.defs.d/PASS_MAX_DAYS.xml">
38 <!ENTITY PASS_MIN_DAYS SYSTEM "login.defs.d/PASS_MIN_DAYS.xml">
39 <!ENTITY PASS_WARN_AGE SYSTEM "login.defs.d/PASS_WARN_AGE.xml">
40 <!ENTITY SHA_CRYPT_MIN_ROUNDS SYSTEM "login.defs.d/SHA_CRYPT_MIN_ROUNDS.xml">
41 <!ENTITY SYS_GID_MAX SYSTEM "login.defs.d/SYS_GID_MAX.xml">
42 <!ENTITY SYS_UID_MAX SYSTEM "login.defs.d/SYS_UID_MAX.xml">
43 <!ENTITY UID_MAX SYSTEM "login.defs.d/UID_MAX.xml">
44 <!ENTITY UMASK SYSTEM "login.defs.d/UMASK.xml">
47 <refentry id='newusers.8'>
50 <refentrytitle>newusers</refentrytitle>
51 <manvolnum>8</manvolnum>
52 <refmiscinfo class="sectdesc">System Management Commands</refmiscinfo>
54 <refnamediv id='name'>
55 <refname>newusers</refname>
56 <refpurpose>update and create new users in batch</refpurpose>
58 <!-- body begins here -->
59 <refsynopsisdiv id='synopsis'>
61 <command>newusers</command>
63 <replaceable>options</replaceable>
64 <replaceable>new_users</replaceable>
69 <refsect1 id='description'>
70 <title>DESCRIPTION</title>
72 The <command>newusers</command> command reads a file of user name and
73 clear-text password pairs and uses this information to update a group
74 of existing users or to create new users. Each line is in the same format
75 as the standard password file (see
76 <citerefentry><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum>
77 </citerefentry>) with the exceptions explained below:
79 <para>pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell</para>
81 <variablelist remap='IP'>
84 <emphasis remap='I'>pw_name</emphasis>
88 This is the name of the user.
91 It can be the name of a new user or the name of an existing
92 user (or an user created before by
93 <command>newusers</command>). In case of an existing user,
94 the user's information will be changed, otherwise a new user
101 <emphasis remap='I'>pw_passwd</emphasis>
105 This field will be encrypted and used as the new value of the
112 <emphasis remap='I'>pw_uid</emphasis>
116 This field is used to define the UID of the user.
119 If the field is empty, an new (unused) UID will be defined
120 automatically by <command>newusers</command>.
123 If this field contains a number, this number will be used as
127 If this field contains the name of an existing user (or the
128 name of an user created before by
129 <command>newusers</command>), the UID of the specified user
133 If the UID of an existing user is changed, the files ownership
134 of the user's file should be fixed manually.
140 <emphasis remap='I'>pw_gid</emphasis>
144 This field is used to define the primary group ID for the user.
147 If this field contains the name of an existing group (or a
148 group created before by <command>newusers</command>), the GID
149 of this group will be used as the primary group ID for the
153 If this field is a number, this number will be used as the
154 primary group ID of the user. If no groups exist with this
155 GID, a new group will be created with this GID, and the name
159 If this field is empty, a new group will be created with the
160 name of the user and a GID will be automatically defined by
161 <command>newusers</command> to be used as the primary group ID
162 for the user and as the GID for the new group.
165 If this field contains the name of a group which does not
166 exist (and was not created earlier wbefore by
167 <command>newusers</command>), a new group will be created with
168 the specified name and a GID will be automatically defined by
169 <command>newusers</command> to be used as the primary group ID
170 for the user and Gs the ID for the new group.
176 <emphasis remap='I'>pw_gecos</emphasis>
180 This field is copied in the GECOS field of the user.
186 <emphasis remap='I'>pw_dir</emphasis>
190 This field is used to define the home directory of the user.
193 If this field does not specify an existing directory, the
194 specified directory is created, with ownership set to the
195 user being created or updated and its primary group.
198 If the home directory of an existing user is changed,
199 <command>newusers</command> does not move or copy the content
200 of the old directory to the new location. This should be done
207 <emphasis remap='I'>pw_shell</emphasis>
211 This field defines the shell of the user.
212 No checks are performed on this field.
219 <command>newusers</command> first tries to create or change all the
220 specified users, and then write these changes to the user or group
221 databases. If an error occurs (except in the final writes to the
222 databases), no changes are committed to the databases.
224 <para condition="pam">
225 During this first pass, users are created with a locked password
226 (and passwords are not changed for the users which are not created).
227 A second pass is used to update the passwords using PAM. Failures
228 to update a password are reported, but will not stop the other
233 This command is intended to be used in a large system environment
234 where many accounts are updated at a single time.
238 <refsect1 id='options'>
239 <title>OPTIONS</title>
241 The options which apply to the <command>newusers</command> command are:
243 <variablelist remap='IP' condition="no_pam">
245 <term><option>-c</option>, <option>--crypt-method</option></term>
247 <para>Use the specified method to encrypt the passwords.</para>
249 The available methods are DES, MD5, NONE, and SHA256 or SHA512
250 if your libc support these methods.
255 <variablelist remap='IP'>
257 <term><option>-h</option>, <option>--help</option></term>
259 <para>Display help message and exit.</para>
264 <option>-r</option>, <option>--system</option>
268 Create a system account.
271 System users will be created with no aging information in
272 <filename>/etc/shadow</filename>, and their numeric
273 identifiers are choosen in the
274 <option>SYS_UID_MIN</option>-<option>SYS_UID_MAX</option>
275 range, defined in <filename>login.defs</filename>, instead of
276 <option>UID_MIN</option>-<option>UID_MAX</option> (and their
277 <option>GID</option> counterparts for the creation of groups).
282 <variablelist remap='IP' condition="no_pam">
283 <varlistentry condition="sha_crypt">
284 <term><option>-s</option>, <option>--sha-rounds</option></term>
287 Use the specified number of rounds to encrypt the passwords.
290 The value 0 means that the system will choose the default
291 number of rounds for the crypt method (5000).
294 A minimal value of 1000 and a maximal value of 999,999,999
298 You can only use this option with the SHA256 or SHA512
302 By default, the number of rounds is defined by the
303 SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in
304 <filename>/etc/login.defs</filename>.
311 <refsect1 id='caveats'>
312 <title>CAVEATS</title>
314 The input file must be protected since it contains unencrypted
317 <para condition="no_pam">
318 You should make sure the passwords and the encryption method respect
319 the system's password policy.
323 <refsect1 id='configuration'>
324 <title>CONFIGURATION</title>
326 The following configuration variables in
327 <filename>/etc/login.defs</filename> change the behavior of this
330 <variablelist condition="no_pam">
334 &GID_MAX; <!-- documents also GID_MIN -->
335 &MAX_MEMBERS_PER_GROUP;
337 <variablelist condition="no_pam">
345 <variablelist condition="no_pam">
346 &SHA_CRYPT_MIN_ROUNDS; <!-- documents also SHA_CRYPT_MAX_ROUNDS-->
349 &SYS_GID_MAX; <!-- documents also SYS_GID_MIN -->
350 &SYS_UID_MAX; <!-- documents also SYS_UID_MIN -->
351 &UID_MAX; <!-- documents also UID_MIN -->
356 <refsect1 id='files'>
360 <term><filename>/etc/passwd</filename></term>
362 <para>User account information.</para>
366 <term><filename>/etc/shadow</filename></term>
368 <para>Secure user account information.</para>
372 <term><filename>/etc/group</filename></term>
374 <para>Group account information.</para>
377 <varlistentry condition="gshadow">
378 <term><filename>/etc/gshadow</filename></term>
380 <para>Secure group account information.</para>
384 <term><filename>/etc/login.defs</filename></term>
386 <para>Shadow password suite configuration.</para>
389 <varlistentry condition="pam">
390 <term><filename>/etc/pam.d/newusers</filename></term>
392 <para>PAM configuration for <command>newusers</command>.</para>
398 <refsect1 id='see_also'>
399 <title>SEE ALSO</title>
402 <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
405 <refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
408 <refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum>