]> granicus.if.org Git - shadow/blob - man/useradd.8
[svn-upgrade] Integrating new upstream version, shadow (4.0.5)
[shadow] / man / useradd.8
1 .\"$Id: useradd.8,v 1.19 2004/10/11 05:09:34 kloczek Exp $
2 .\" Copyright 1991 - 1994, Julianne Frances Haugh
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. Neither the name of Julianne F. Haugh nor the names of its contributors
14 .\"    may be used to endorse or promote products derived from this software
15 .\"    without specific prior written permission.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED.  IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" SUCH DAMAGE.
28 .TH USERADD 8
29 .SH NAME
30 useradd \- Create a new user or update default new user information
31 .SH SYNOPSIS
32 .TP 8
33 \fBuseradd\fR [\fB-c\fR \fIcomment\fR] [\fB-d\fR \fIhome_dir\fR]
34 .br
35 [\fB-e\fR \fIexpire_date\fR] [\fB-f\fR \fIinactive_time\fR]
36 .br
37 [\fB-g\fR \fIinitial_group\fR] [\fB-G\fR \fIgroup\fR[,...]]
38 .br
39 [[\fB-M\fR] \fB-m\fR [\fB-k\fR \fIskeleton_dir\fR]] [\fB-o\fR] [\fB-p\fR \fIpasswd\fR]
40 .br
41 [\fB-s\fR \fIshell\fR] [\fB-u\fR \fIuid\fR] \fIlogin\fR
42 .TP 8
43 \fBuseradd\fR \fB-D\fR [\fB-g\fI default_group\fR] [\fB-b\fI default_home\fR]
44 .br
45 [\fB-e\fI default_expire_date\fR] [\fB-f\fI default_inactive\fR]
46 .br
47 [\fB-s\fI default_shell\fR]
48 .SH DESCRIPTION
49 .SS Creating New Users
50 When invoked without the \fB-D\fR option, the \fBuseradd\fR command creates
51 a new user account using the values specified on the command line and the
52 default values from the system. Depending on command line options, the
53 useradd command will update system files and may also create the new user's
54 home directory and copy initial files. The options which apply to the
55 \fBuseradd\fR command are:
56 .IP "\fB-c\fR \fIcomment\fR"
57 The new user's password file comment field.
58 .IP "\fB-d\fR \fIhome_dir\fR"
59 The new user will be created using \fIhome_dir\fR as the value for the
60 user's login directory. The default is to append the \fIlogin\fR name to
61 \fIdefault_home\fR and use that as the login directory name.
62 .IP "\fB-e\fR \fIexpire_date\fR"
63 The date on which the user account will be disabled. The date is specified
64 in the format \fIYYYY-MM-DD\fR.
65 .IP "\fB-f\fR \fIinactive_days\fR"
66 The number of days after a password expires until the account is permanently
67 disabled. A value of 0 disables the account as soon as the password has
68 expired, and a value of -1 disables the feature. The default value is -1.
69 .IP "\fB-g\fR \fIinitial_group\fR"
70 The group name or number of the user's initial login group. The group name
71 must exist.  A group number must refer to an already existing group. The
72 default group number is 1 or whatever is specified in
73 \fI/etc/default/useradd\fR.
74 .IP "\fB-G\fR \fIgroup,[...]\fR"
75 A list of supplementary groups which the user is also a member of. Each
76 group is separated from the next by a comma, with no intervening whitespace.
77 The groups are subject to the same restrictions as the group given with the
78 \fB-g\fR option. The default is for the user to belong only to the initial
79 group.
80 .IP \fB-M\fR
81 RedHat added the CREATE_HOME option in login.defs in their version of
82 shadow-utils (which makes -m the default, with new -M option to turn it
83 off). Unfortunately, this changes the way useradd works (it can be run by
84 scripts expecting some standard behaviour), compared to other Unices and
85 other Linux distributions, and also adds a lot of confusion.
86 .IP \fB-m\fR
87 The user's home directory will be created if it does not exist. The files
88 contained in \fIskeleton_dir\fR will be copied to the home directory if the
89 \fB-k\fR option is used, otherwise the files contained in \fI/etc/skel\fR
90 will be used instead. Any directories contained in \fIskeleton_dir\fR or
91 \fI/etc/skel\fR will be created in the user's home directory as well. The
92 \fB-k\fR option is only valid in conjunction with the \fB-m\fR option. The
93 default is to not create the directory and to not copy any files.
94 .IP "\fB-o\fR"
95 Allow create user with duplicate (non-unique) UID.
96 .IP "\fB-p \fIpasswd\fR"
97 The encrypted password, as returned by \fBcrypt\fR(3). The default is to
98 disable the account.
99 .IP "\fB-s\fR \fIshell\fR"
100 The name of the user's login shell. The default is to leave this field
101 blank, which causes the system to select the default login shell.
102 .IP "\fB-u \fIuid\fR"
103 The numerical value of the user's ID. This value must be unique, unless the
104 \fI-o\fR option is used. The value must be non-negative. The default is to
105 use the smallest ID value greater than 99 and greater than every other user.
106 Values between 0 and 99 are typically reserved for system accounts.
107 .SS Changing the default values
108 When invoked with the \fB-D\fR option, \fBuseradd\fR will either display the
109 current default values, or update the default values from the command line.
110 The valid options are
111 .IP "\fB-b\fR \fIdefault_home\fR"
112 The initial path prefix for a new user's home directory. The user's name
113 will be affixed to the end of \fIdefault_home\fR to create the new directory
114 name if the \fB-d\fI option is not used when creating a new account.
115 .IP "\fB-e\fR \fIdefault_expire_date\fR"
116 The date on which the user account is disabled.
117 .IP "\fB-f\fR \fIdefault_inactive\fR"
118 The number of days after a password has expired before the account will be
119 disabled.
120 .IP "\fB-g\fR \fIdefault_group\fR"
121 The group name or ID for a new user's initial group. The named group must
122 exist, and a numerical group ID must have an existing entry .
123 .IP "\fB-s\fR \fIdefault_shell\fR"
124 The name of the new user's login shell. The named program will be used for
125 all future new user accounts.
126 .PP
127 If no options are specified, \fBuseradd\fR displays the current default
128 values.
129 .SH NOTES
130 The system administrator is responsible for placing the default user files
131 in the \fI/etc/skel/\fR directory.
132 .SH CAVEATS
133 You may not add a user to an NIS group. This must be performed on the NIS
134 server.
135 .SH FILES
136 \fI/etc/passwd\fR                       \- user account information
137 .br
138 \fI/etc/shadow\fR                       \- secure user account information
139 .br
140 \fI/etc/group\fR                        \- group information
141 .br
142 \fI/etc/default/useradd\fR      \- default information
143 .br
144 \fI/etc/skel/\fR                        \- directory containing default files
145 .SH EXIT VALUES
146 .TP 2
147 The \fBuseadd\fR command exits with the following values:
148 .br
149 \fB0\fR \- success
150 .br
151 \fB1\fR \- can't update password file
152 .br
153 \fB2\fR \- invalid command syntax
154 .br
155 \fB3\fR \- invalid argument to option
156 .br
157 \fB4\fR \- uid already in use (and no -o)
158 .br
159 \fB6\fR \- specified group doesn't exist
160 .br
161 \fB9\fR \- username already in use
162 .br
163 \fB10\fR        \- can't update group file
164 .br
165 \fB12\fR        \- can't create home directory
166 .br
167 \fB13\fR        \- can't create mail spool
168 .SH SEE ALSO
169 .BR chfn (1),
170 .BR chsh (1),
171 .BR passwd (1),
172 .BR crypt (3),
173 .BR groupadd (8),
174 .BR groupdel (8),
175 .BR groupmod (8),
176 .BR userdel (8),
177 .BR usermod (8)
178 .SH AUTHOR
179 Julianne Frances Haugh (jockgrrl@ix.netcom.com)