]> granicus.if.org Git - shadow/blob - man/useradd.8
[svn-upgrade] Integrating new upstream version, shadow (4.0.14)
[shadow] / man / useradd.8
1 .\" ** You probably do not want to edit this file directly **
2 .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
3 .\" Instead of manually editing it, you probably should edit the DocBook XML
4 .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
5 .TH "USERADD" "8" "01/02/2006" "System Management Commands" "System Management Commands"
6 .\" disable hyphenation
7 .nh
8 .\" disable justification (adjust text to left margin only)
9 .ad l
10 .SH "NAME"
11 useradd \- Create a new user or update default new user information
12 .SH "SYNOPSIS"
13 .HP 8
14 \fBuseradd\fR [\fIoptions\fR] \fILOGIN\fR
15 .HP 8
16 \fBuseradd\fR \-D
17 .HP 8
18 \fBuseradd\fR \-D [\fIoptions\fR]
19 .SH "DESCRIPTION"
20 .PP
21 When invoked without the
22 \fB\-D\fR
23 option, the
24 \fBuseradd\fR
25 command creates a new user account using the values specified on the command line and the default values from the system. Depending on command line options, the useradd command will update system files and may also create the new user's home directory and copy initial files.
26 .SH "OPTIONS"
27 .PP
28 The options which apply to the
29 \fBuseradd\fR
30 command are:
31 .TP
32 \fB\-c\fR, \fB\-\-comment\fR \fICOMMENT\fR
33 Any text string. It is generally a short description of the login, and is currently used as the field for the user's full name.
34 .TP
35 \fB\-b\fR, \fB\-\-base\-dir\fR \fIBASE_DIR\fR
36 The default base directory for the system if
37 \fB\-d\fR
38 dir is not specified.
39 \fIBASE_DIR\fR
40 is concatenated with the account name to define the home directory. If the
41 \fB\-m\fR
42 option is not used, base_dir must exist.
43 .TP
44 \fB\-d\fR, \fB\-\-home\fR \fIHOME_DIR\fR
45 The new user will be created using
46 \fIHOME_DIR\fR
47 as the value for the user's login directory. The default is to append the
48 \fILOGIN\fR
49 name to
50 \fIBASE_DIR\fR
51 and use that as the login directory name.
52 .TP
53 \fB\-e\fR, \fB\-\-expiredate\fR \fIEXPIRE_DATE\fR
54 The date on which the user account will be disabled. The date is specified in the format
55 \fIYYYY\-MM\-DD\fR.
56 .TP
57 \fB\-f\fR, \fB\-\-inactive\fR \fIINACTIVE\fR
58 The number of days after a password expires until the account is permanently disabled. A value of 0 disables the account as soon as the password has expired, and a value of \-1 disables the feature. The default value is \-1.
59 .TP
60 \fB\-g\fR, \fB\-\-gid\fR \fIGROUP\fR
61 The group name or number of the user's initial login group. The group name must exist. A group number must refer to an already existing group. The default group number is 1 or whatever is specified in
62 \fI/etc/default/useradd\fR.
63 .TP
64 \fB\-G\fR, \fB\-\-groups\fR \fIGROUP1\fR[\fI,GROUP2,...\fR[\fI,GROUPN\fR]]]
65 A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no intervening whitespace. The groups are subject to the same restrictions as the group given with the
66 \fB\-g\fR
67 option. The default is for the user to belong only to the initial group.
68 .TP
69 \fB\-h\fR, \fB\-\-help\fR
70 Display help message and exit.
71 .TP
72 \fB\-m\fR, \fB\-\-create\-home\fR
73 The user's home directory will be created if it does not exist. The files contained in
74 \fISKEL_DIR\fR
75 will be copied to the home directory if the
76 \fB\-k\fR
77 option is used, otherwise the files contained in
78 \fI/etc/skel\fR
79 will be used instead. Any directories contained in
80 \fISKEL_DIR\fR
81 or
82 \fI/etc/skel\fR
83 will be created in the user's home directory as well. The
84 \fB\-k\fR
85 option is only valid in conjunction with the
86 \fB\-m\fR
87 option. The default is to not create the directory and to not copy any files.
88 .TP
89 \fB\-K\fR, \fB\-\-key\fR \fIKEY\fR=\fIVALUE\fR
90 Overrides /etc/login.defs defaults (UID_MIN, UID_MAX, UMASK, PASS_MAX_DAYS and others).
91
92 Example:
93 \fB\-K \fR\fIPASS_MAX_DAYS\fR=\fI\-1\fR
94 can be used when creating system account to turn off password ageing, even though system account has no password at all. Multiple
95 \fB\-K\fR
96 options can be specified, e.g.:
97 \fB\-K \fR\fIUID_MIN\fR=\fI100\fR\fB \-K \fR\fIUID_MAX\fR=\fI499\fR
98 .sp
99 Note:
100 \fB\-K \fR\fIUID_MIN\fR=\fI10\fR,\fIUID_MAX\fR=\fI499\fR
101 doesn't work yet.
102 .TP
103 \fB\-o\fR, \fB\-\-non\-unique\fR
104 Allow create user account with duplicate (non\-unique) UID.
105 .TP
106 \fB\-p\fR, \fB\-\-password\fR \fIPASSWORD\fR
107 The encrypted password, as returned by
108 \fBcrypt\fR(3). The default is to disable the account.
109 .TP
110 \fB\-s\fR, \fB\-\-shell\fR \fISHELL\fR
111 The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell.
112 .TP
113 \fB\-u\fR, \fB\-\-uid\fR \fIUID\fR
114 The numerical value of the user's ID. This value must be unique, unless the
115 \fB\-o\fR
116 option is used. The value must be non\-negative. The default is to use the smallest ID value greater than 999 and greater than every other user. Values between 0 and 999 are typically reserved for system accounts.
117 .SS "Changing the default values"
118 .PP
119 When invoked with the
120 \fB\-D\fR
121 option,
122 \fBuseradd\fR
123 will either display the current default values, or update the default values from the command line. The valid options are
124 .TP
125 \fB\-b\fR \fIHOME_DIR\fR
126 The initial path prefix for a new user's home directory. The user's name will be affixed to the end of
127 \fIHOME_DIR\fR
128 to create the new directory name if the
129 \fB\-d\fR
130 option is not used when creating a new account.
131 .TP
132 \fB\-e\fR \fIEXPIRE_DATE\fR
133 The date on which the user account is disabled.
134 .TP
135 \fB\-f\fR \fIINACTIVE\fR
136 The number of days after a password has expired before the account will be disabled.
137 .TP
138 \fB\-g\fR, \fB\-\-gid\fR \fIGROUP\fR
139 The group name or ID for a new user's initial group. The named group must exist, and a numerical group ID must have an existing entry.
140 .TP
141 \fB\-s\fR, \fB\-\-shell\fR \fISHELL\fR
142 The name of the new user's login shell. The named program will be used for all future new user accounts.
143 .PP
144 If no options are specified,
145 \fBuseradd\fR
146 displays the current default values.
147 .SH "NOTES"
148 .PP
149 The system administrator is responsible for placing the default user files in the
150 \fI/etc/skel/\fR
151 directory.
152 .SH "CAVEATS"
153 .PP
154 You may not add a user to a NIS group. This must be performed on the NIS server.
155 .PP
156 Similarly, if the username already exists in an external user database such as NIS,
157 \fBuseradd\fR
158 will deny the user account creation request.
159 .PP
160 Usernames must begin with a lower case letter or an underscore, and only lower case letters, underscores, dashes, and dollar signs may follow. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]
161 .SH "FILES"
162 .TP
163 \fI/etc/passwd\fR
164 user account information
165 .TP
166 \fI/etc/shadow\fR
167 secure user account information
168 .TP
169 \fI/etc/group\fR
170 group account information
171 .TP
172 \fI/etc/default/useradd\fR
173 default information
174 .TP
175 \fI/etc/skel/\fR
176 directory containing default files
177 .TP
178 \fI/etc/login.defs\fR
179 shadow password suite configuration
180 .SH "EXIT VALUES"
181 .PP
182 The
183 \fBuseradd\fR
184 command exits with the following values:
185 .TP
186 \fI0\fR
187 success
188 .TP
189 \fI1\fR
190 can't update password file
191 .TP
192 \fI2\fR
193 invalid command syntax
194 .TP
195 \fI3\fR
196 invalid argument to option
197 .TP
198 \fI4\fR
199 UID already in use (and no
200 \fB\-o\fR)
201 .TP
202 \fI6\fR
203 specified group doesn't exist
204 .TP
205 \fI9\fR
206 username already in use
207 .TP
208 \fI10\fR
209 can't update group file
210 .TP
211 \fI12\fR
212 can't create home directory
213 .TP
214 \fI13\fR
215 can't create mail spool
216 .SH "SEE ALSO"
217 .PP
218 \fBchfn\fR(1),
219 \fBchsh\fR(1),
220 \fBpasswd\fR(1),
221 \fBcrypt\fR(3),
222 \fBgroupadd\fR(8),
223 \fBgroupdel\fR(8),
224 \fBgroupmod\fR(8),
225 \fBlogin.defs\fR(5),
226 \fBuserdel\fR(8),
227 \fBusermod\fR(8).