1 .\" Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
2 .\" All rights reserved.
3 .\" Copyright (c) 2002 Michael Telahun Makonnen <makonnen@pacbell.net>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd command for adding new users
39 .Op Fl L Ar login_class
43 .Op Fl m Ar message_file
50 utility is a shell script, implemented around the
52 command, for adding new users.
53 It creates passwd/group entries, a home directory,
54 copies dotfiles and sends the new user a welcome message.
55 It supports two modes of operation.
56 It may be used interactively
57 at the command line to add one user at a time, or it may be directed
58 to get the list of new users from a file and operate in batch mode
59 without requiring any user interaction.
61 .Bl -tag -width indent
64 The user name is restricted to whatever
67 Generally this means it
68 may contain only lowercase characters or digits.
71 The reasons for this limit are historical.
72 Given that people have traditionally wanted to break this
73 limit for aesthetic reasons, it has never been of great importance to break
74 such a basic fundamental parameter in
79 .Pa /usr/include/utmp.h
81 world; people have done this and it works, but you will have problems
82 with any precompiled programs, or source that assumes the 8-character
84 The NIS protocol mandates an 8-character username.
85 If you need a longer login name for e-mail addresses,
86 you can define an alias in
87 .Pa /etc/mail/aliases .
89 This is typically known as the gecos field and usually contains
91 Additionally, it may contain a comma separated
92 list of values such as office number and work and home phones.
94 name contains an amperstand it will be replaced by the capitalized
95 login name when displayed by other programs.
98 character is not allowed.
100 Only valid shells from the shell database
104 addition, only the base name of the shell is necessary, not the full path.
106 Automatically generated or your choice.
107 It must be less than 32000.
108 .It "GID/login group"
109 Automatically generated or your choice.
110 It must be less than 32000.
112 You may choose an empty password, disable the password, use a
113 randomly generated password or specify your own plaintext password,
114 which will be encrypted before being stored in the user database.
117 Perhaps you are missing what
119 be done with this scheme that falls apart
120 with most other schemes.
121 With each user in his/her own group, the user can
122 safely run with a umask of 002 instead of the usual 022
123 and create files in their home directory
124 without worrying about others being able to change them.
126 For a shared area you create a separate UID/GID (like cvs or ncvs on freefall),
127 you place each person that should be able to access this area into that new
130 This model of UID/GID administration allows far greater flexibility than lumping
131 users into groups and having to muck with the umask when working in a shared
134 I have been using this model for almost 10 years and found that it works
135 for most situations, and has never gotten in the way.
140 utility reads its configuration information from
141 .Pa /etc/adduser.conf .
142 If this file does not exist, it will use predefined defaults.
143 While this file may be edited by hand,
144 the safer option is to use the
146 command line argument.
149 will start interactive input, save the answers to its prompts in
150 .Pa /etc/adduser.conf ,
151 and promptly exit without modifying the user
153 Options specified on the command line will take precedence over
154 any values saved in this file.
156 .Bl -tag -width indent
158 Create new configuration file and exit.
159 This option is mutually exclusive with the
162 .It Fl d Ar partition
164 Default partition, under which all user directories
168 This option will lock the account by prepending the string
170 to the password field.
171 The account may be unlocked
172 by the super-user with the
176 .D1 Nm pw Cm unlock Op Ar name | uid
178 Get the list of accounts to create from
184 then get the list from standard input.
185 If this option is specified,
187 will operate in batch mode and will not seek any user input.
188 If an error is encountered while processing an account, it will write a
189 message to standard error and move to the next account.
191 of the input file is described below.
194 By default, the user name is used as the login group.
195 This option allows the user to specify additional groups to add users to.
197 Print a summary of options and exit.
198 .It Fl k Ar directory
202 directory of new users;
206 .It Fl L Ar login_class
207 Set default login class.
209 Send new users a welcome message from
211 Specifying a value of
215 causes no message to be sent to new users.
216 Please note that the message
217 file can reference the internal variables of the
221 Do not read the default configuration file.
223 Minimal user feedback.
224 In particular, the random password will not be echoed to
227 Default shell for new users.
230 argument must be the base name of the shell,
235 to be considered a valid shell.
244 utility allows the user to specify what type of password to create.
247 argument may have one of the following values:
248 .Bl -tag -width ".Cm random"
250 Disable the password.
251 Instead of an encrypted string, the passowrd field will contain a single
254 The user may not log in until the super-user
255 manually enables the password.
257 Use an empty string as the password.
259 Use a user-supplied string as the password.
261 the user will be prompted for the password.
263 last (10th) field in the line is assumed to be the password.
265 Generate a random string and use it as a password.
266 The password will be echoed to standard output.
267 In addition, it will be available for inclusion in the message file in the
275 option is used, the account information must be stored in a specific
277 All empty lines or lines beginning with a
280 All other lines must contain ten colon
282 separated fields as described below.
283 Command line options do not take precedence
284 over values in the fields.
285 Only the password field may contain a
287 character as part of the string.
290 .D1 Ar name : uid : gid : class : change : expire : gecos : home_dir : shell : password
292 .Bl -tag -width ".Ar password"
295 This field may not be empty.
297 Numeric login user ID.
298 If this field is left empty, it will be automatically generated.
300 Numeric primary group ID.
301 If this field is left empty, a group with the
302 same name as the user name will be created and its GID will be used
306 This field may be left empty.
309 This field denotes the password change date for the account.
310 The format of this field is the same as the format of the
315 .Ar dd Ns - Ns Ar mmm Ns - Ns Ar yy Ns Op Ar yy ,
320 is for the month in numeric or alphabetical format:
326 is the four or two digit year.
327 To denote a time relative to the current date the format is:
328 .No + Ns Ar n Ns Op Ar mhdwoy ,
331 denotes a number, followed by the minutes, hours, days, weeks,
332 months or years after which the password must be changed.
333 This field may be left empty to turn it off.
336 This field denotes the expiry date of the account.
337 The account may not be used after the specified date.
338 The format of this field is the same as that for password ageing.
339 This field may be left empty to turn it off.
341 Full name and other extra information about the user.
344 If this field is left empty, it will be automatically
345 created by appending the username to the home partition.
348 This field should contain the full path to a valid login shell.
351 This field should contain a plaintext string, which will
352 be encrypted before being placed in the user database.
353 If the password type is
355 and this field is empty, it is assumed the account will have an empty password.
356 If the password type is
360 empty, its contents will be used
362 This field will be ignored if the
364 option is used with a
369 Be carefull not to terminate this field with a closing
371 because it will be treated as part of the password.
374 .Bl -tag -width ".Pa /etc/adduser.message" -compact
375 .It Pa /etc/master.passwd
381 .It Pa /etc/login.conf
382 login classes database
383 .It Pa /etc/adduser.conf
384 configuration file for
386 .It Pa /etc/adduser.message
389 .It Pa /usr/share/skel
390 skeletal login directory
391 .It Pa /var/log/adduser
415 This manual page and the original script, in Perl, was written by
416 .An Wolfram Schneider Aq wosch@FreeBSD.org .
417 The replacement script, written as a Bourne
418 shell script with some enhancements, and the man page modification that
419 came with it were done by
420 .An Mike Makonnen Aq mtm@identd.net .
424 to correctly expand variables such as
428 in the message sent to new users, it must let the shell evaluate
429 each line of the message file.
430 This means that shell commands can also be embedded in the message file.
433 utility attemps to mitigate the possibility of an attacker using this
434 feature by refusing to evaluate the file if it is not owned and writeable
435 only by the root user.
436 In addition, shell special characters and operators will have to be
437 escaped when used in the message file.
439 Also, password ageing and account expiry times are currently setable
441 The user should be able to set them in interactive mode as well.