]> granicus.if.org Git - shadow/blob - man/useradd.8
[svn-upgrade] Integrating new upstream version, shadow (4.0.7)
[shadow] / man / useradd.8
1 .\"$Id: useradd.8,v 1.23 2004/12/11 20:05:01 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_days\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.
55 .SH OPTIONS
56 The options which apply to the
57 \fBuseradd\fR command are:
58 .IP "\fB-c\fR \fIcomment\fR"
59 The new user's password file comment field.
60 .IP "\fB-d\fR \fIhome_dir\fR"
61 The new user will be created using \fIhome_dir\fR as the value for the
62 user's login directory. The default is to append the \fIlogin\fR name to
63 \fIdefault_home\fR and use that as the login directory name.
64 .IP "\fB-e\fR \fIexpire_date\fR"
65 The date on which the user account will be disabled. The date is specified
66 in the format \fIYYYY-MM-DD\fR.
67 .IP "\fB-f\fR \fIinactive_days\fR"
68 The number of days after a password expires until the account is permanently
69 disabled. A value of 0 disables the account as soon as the password has
70 expired, and a value of -1 disables the feature. The default value is -1.
71 .IP "\fB-g\fR \fIinitial_group\fR"
72 The group name or number of the user's initial login group. The group name
73 must exist.  A group number must refer to an already existing group. The
74 default group number is 1 or whatever is specified in
75 \fI/etc/default/useradd\fR.
76 .IP "\fB-G\fR \fIgroup,[...]\fR"
77 A list of supplementary groups which the user is also a member of. Each
78 group is separated from the next by a comma, with no intervening whitespace.
79 The groups are subject to the same restrictions as the group given with the
80 \fB-g\fR option. The default is for the user to belong only to the initial
81 group.
82 .IP \fB-M\fR
83 RedHat added the CREATE_HOME option in login.defs in their version of
84 shadow-utils (which makes -m the default, with new -M option to turn it
85 off). Unfortunately, this changes the way useradd works (it can be run by
86 scripts expecting some standard behaviour), compared to other Unices and
87 other Linux distributions, and also adds a lot of confusion.
88 .IP \fB-m\fR
89 The user's home directory will be created if it does not exist. The files
90 contained in \fIskeleton_dir\fR will be copied to the home directory if the
91 \fB-k\fR option is used, otherwise the files contained in \fI/etc/skel\fR
92 will be used instead. Any directories contained in \fIskeleton_dir\fR or
93 \fI/etc/skel\fR will be created in the user's home directory as well. The
94 \fB-k\fR option is only valid in conjunction with the \fB-m\fR option. The
95 default is to not create the directory and to not copy any files.
96 .IP "\fB-o\fR"
97 Allow create user with duplicate (non-unique) UID.
98 .IP "\fB-p \fIpasswd\fR"
99 The encrypted password, as returned by \fBcrypt\fR(3). The default is to
100 disable the account.
101 .IP "\fB-s\fR \fIshell\fR"
102 The name of the user's login shell. The default is to leave this field
103 blank, which causes the system to select the default login shell.
104 .IP "\fB-u \fIuid\fR"
105 The numerical value of the user's ID. This value must be unique, unless the
106 \fI-o\fR option is used. The value must be non-negative. The default is to
107 use the smallest ID value greater than 999 and greater than every other user.
108 Values between 0 and 999 are typically reserved for system accounts.
109 .SS Changing the default values
110 When invoked with the \fB-D\fR option, \fBuseradd\fR will either display the
111 current default values, or update the default values from the command line.
112 The valid options are
113 .IP "\fB-b\fR \fIdefault_home\fR"
114 The initial path prefix for a new user's home directory. The user's name
115 will be affixed to the end of \fIdefault_home\fR to create the new directory
116 name if the \fB-d\fR option is not used when creating a new account.
117 .IP "\fB-e\fR \fIdefault_expire_date\fR"
118 The date on which the user account is disabled.
119 .IP "\fB-f\fR \fIdefault_inactive\fR"
120 The number of days after a password has expired before the account will be
121 disabled.
122 .IP "\fB-g\fR \fIdefault_group\fR"
123 The group name or ID for a new user's initial group. The named group must
124 exist, and a numerical group ID must have an existing entry .
125 .IP "\fB-s\fR \fIdefault_shell\fR"
126 The name of the new user's login shell. The named program will be used for
127 all future new user accounts.
128 .PP
129 If no options are specified, \fBuseradd\fR displays the current default
130 values.
131 .SH NOTES
132 The system administrator is responsible for placing the default user files
133 in the \fI/etc/skel/\fR directory.
134 .SH CAVEATS
135 You may not add a user to an NIS group. This must be performed on the NIS
136 server.
137 .SH FILES
138 \fI/etc/passwd\fR                       \- user account information
139 .br
140 \fI/etc/shadow\fR                       \- secure user account information
141 .br
142 \fI/etc/group\fR                        \- group information
143 .br
144 \fI/etc/default/useradd\fR      \- default information
145 .br
146 \fI/etc/skel/\fR                        \- directory containing default files
147 .SH EXIT VALUES
148 .TP 2
149 The \fBuseadd\fR command exits with the following values:
150 .br
151 \fB0\fR \- success
152 .br
153 \fB1\fR \- can't update password file
154 .br
155 \fB2\fR \- invalid command syntax
156 .br
157 \fB3\fR \- invalid argument to option
158 .br
159 \fB4\fR \- uid already in use (and no -o)
160 .br
161 \fB6\fR \- specified group doesn't exist
162 .br
163 \fB9\fR \- username already in use
164 .br
165 \fB10\fR        \- can't update group file
166 .br
167 \fB12\fR        \- can't create home directory
168 .br
169 \fB13\fR        \- can't create mail spool
170 .SH SEE ALSO
171 .BR chfn (1),
172 .BR chsh (1),
173 .BR passwd (1),
174 .BR crypt (3),
175 .BR groupadd (8),
176 .BR groupdel (8),
177 .BR groupmod (8),
178 .BR userdel (8),
179 .BR usermod (8)
180 .SH AUTHOR
181 Julianne Frances Haugh (jockgrrl@ix.netcom.com)