2 .\" Copyright (c) 2013 Gary Mills
3 .\" Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
4 .\" Copyright 1989 AT&T
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH USERADD 1M "Feb 25, 2017"
10 useradd \- administer a new user login on the system
14 \fBuseradd\fR [\fB-A\fR \fIauthorization\fR [,\fIauthorization...\fR]]
15 [\fB-b\fR \fIbase_dir\fR] [\fB-c\fR \fIcomment\fR] [\fB-d\fR \fIdir\fR] [\fB-e\fR \fIexpire\fR]
16 [\fB-f\fR \fIinactive\fR] [\fB-g\fR \fIgroup\fR] [\fB-G\fR \fIgroup\fR [,\fIgroup\fR]...]
17 [\fB-K\fR \fIkey=value\fR] [\fB-m\fR [\fB-z|-Z\fR] [\fB-k\fR \fIskel_dir\fR]] [\fB-p\fR \fIprojname\fR]
18 [\fB-P\fR \fIprofile\fR [,\fIprofile...\fR]] [\fB-R\fR \fIrole\fR [,\fIrole...\fR]]
19 [\fB-s\fR \fIshell\fR] [\fB-u\fR \fIuid\fR [\fB-o\fR]] \fIlogin\fR
24 \fBuseradd\fR \fB-D\fR
29 \fBuseradd\fR adds a new user to the \fB/etc/passwd\fR and \fB/etc/shadow\fR
30 and \fB/etc/user_attr\fR files. The \fB-A\fR and \fB-P\fR options respectively
31 assign authorizations and profiles to the user. The \fB-R\fR option assigns
32 roles to a user. The \fB-p\fR option associates a project with a user. The
33 \fB-K\fR option adds a \fIkey=value\fR pair to \fB/etc/user_attr\fR for the
34 user. Multiple \fIkey=value\fR pairs may be added with multiple \fB-K\fR
38 \fBuseradd\fR also creates supplementary group memberships for the user
39 (\fB-G\fR option) and creates the home directory (\fB-m\fR option) for the user
40 if requested. The new login remains locked until the \fBpasswd\fR(1) command is
44 The system file entries created with this command have a limit of 2048
45 characters per line. Specifying long arguments to several options can exceed
49 \fBuseradd\fR requires that usernames be in the format described in
50 \fBpasswd\fR(4). A warning message is displayed if these restrictions are not
51 met. See \fBpasswd\fR(4) for the requirements for usernames.
53 To change the action of \fBuseradd\fR when the traditional login name
54 length limit of eight characters is exceeded, edit the file
55 \fB/etc/default/useradd\fR by removing the \fB#\fR (pound sign) before the
56 appropriate \fBEXCEED_TRAD=\fR entry, and adding it before the others.
59 The following options are supported:
63 \fB\fB-A\fR \fIauthorization\fR\fR
67 One or more comma separated authorizations defined in \fBauth_attr\fR(4). Only
68 a user or role who has \fBgrant\fR rights to the authorization can assign it to
75 \fB\fB-b\fR \fIbase_dir\fR\fR
79 The base directory for new login home directories (see the \fB-d\fR option
80 below. When a new user account is being created, \fIbase_dir\fR must already
81 exist unless the \fB-m\fR option or the \fB-d\fR option is also specified.
87 \fB\fB-c\fR \fIcomment\fR\fR
91 Any text string. It is generally a short description of the login, and is
92 currently used as the field for the user's full name. This information is
93 stored in the user's \fB/etc/passwd\fR entry.
99 \fB\fB-d\fR \fIdir\fR\fR
103 The home directory of the new user. It defaults to
104 \fIbase_dir\fR/\fIaccount_name\fR, where \fIbase_dir\fR is the base directory
105 for new login home directories and \fIaccount_name\fR is the new login name.
115 Display the default values for \fBgroup\fR, \fBbase_dir\fR, \fBskel_dir\fR,
116 \fBshell\fR, \fBinactive\fR, \fBexpire\fR, \fBproj\fR, \fBprojname\fR and
117 \fBkey=value\fR pairs. The default values are:
125 \fBother\fR (\fBGID\fR of 1)
221 \fBkey=value (pairs defined in \fBuser_attr\fR(4)\fR
243 \fB\fB-e\fR \fIexpire\fR\fR
247 Specify the expiration date for a login. After this date, no user will be able
248 to access this login. The expire option argument is a date entered using one of
249 the date formats included in the template file \fB/etc/datemsk\fR. See
252 If the date format that you choose includes spaces, it must be quoted. For
253 example, you can enter \fB10/6/90\fR or \fBOctober 6, 1990\fR. A null value
254 (\fB" "\fR) defeats the status of the expired date. This option is useful for
255 creating temporary logins.
261 \fB\fB-f\fR \fIinactive\fR\fR
265 The maximum number of days allowed between uses of a login ID before that
266 \fBID\fR is declared invalid. Normal values are positive integers. A value of
267 \fB0\fR defeats the status.
273 \fB\fB-g\fR \fIgroup\fR\fR
277 An existing group's integer \fBID\fR or character-string name. It defines the
278 new user's primary group membership and defaults to the default group.
284 \fB\fB-G\fR \fIgroup\fR\fR
288 An existing group's integer \fBID\fR or character-string name. It defines the
289 new user's supplementary group membership. Duplicates between \fIgroup\fR with
290 the \fB-g\fR and \fB-G\fR options are ignored. No more than \fBNGROUPS_MAX\fR
291 groups can be specified. GIDs 0-99 are reserved for allocation by the Solaris
298 \fB\fB-K\fR \fIkey=value\fR\fR
302 A \fIkey=value\fR pair to add to the user's attributes. Multiple \fB-K\fR
303 options may be used to add multiple \fIkey=value\fR pairs. The generic \fB-K\fR
304 option with the appropriate key may be used instead of the specific implied key
305 options (\fB-A\fR, \fB-P\fR, \fB-R\fR, \fB-p\fR). See \fBuser_attr\fR(4) for a
306 list of valid \fIkey=value\fR pairs. The "type" key is not a valid key for this
307 option. Keys may not be repeated.
313 \fB\fB-k\fR \fIskel_dir\fR\fR
317 A directory that contains skeleton information (such as \fB\&.profile\fR) that
318 can be copied into a new user's home directory. This directory must already
319 exist. The system provides the \fB/etc/skel\fR directory that can be used for
326 \fB\fB-m\fR\fR [\fB-z|-Z\fR]
330 Create the new user's home directory if it does not already exist. If the
331 directory already exists, it must have read, write, and execute permissions by
332 \fIgroup\fR, where \fIgroup\fR is the user's primary group.
334 If the parent directory of the user's home directory is located on a separate
335 \fBZFS\fR file system and the \fB/etc/default/useradd\fR file contains the
336 parameter \fBMANAGE_ZFS\fR set to the value \fBYES\fR, a new \fBZFS\fR
337 file system will be created for the user.
339 If the \fB-z\fR option is specified, \fBuseradd\fR will always try to create
340 a new file system for the home directory.
342 If the \fB-Z\fR option is specified, a new file system will never be created.
352 This option allows a \fBUID\fR to be duplicated (non-unique).
358 \fB\fB-P\fR \fIprofile\fR\fR
362 One or more comma-separated execution profiles defined in \fBprof_attr\fR(4).
368 \fB\fB-p\fR \fIprojname\fR\fR
372 Name of the project with which the added user is associated. See the
373 \fIprojname\fR field as defined in \fBproject\fR(4).
379 \fB\fB-R\fR \fIrole\fR\fR
383 One or more comma-separated execution profiles defined in \fBuser_attr\fR(4).
384 Roles cannot be assigned to other roles.
390 \fB\fB-s\fR \fIshell\fR\fR
394 Full pathname of the program used as the user's shell on login. It defaults to
395 an empty field causing the system to use \fB/bin/sh\fR as the default. The
396 value of \fIshell\fR must be a valid executable file.
402 \fB\fB-u\fR \fIuid\fR\fR
406 The \fBUID\fR of the new user. This \fBUID\fR must be a non-negative decimal
407 integer below \fBMAXUID\fR as defined in \fB<sys/param.h>\fR\&. The \fBUID\fR
408 defaults to the next available (unique) number above the highest number
409 currently assigned. For example, if \fBUID\fRs 100, 105, and 200 are assigned,
410 the next default \fBUID\fR number will be 201. \fBUID\fRs \fB0\fR-\fB99\fR are
411 reserved for allocation by the Solaris Operating System.
416 \fB/etc/default/useradd\fR
434 \fB/usr/include/limits.h\fR
440 See \fBattributes\fR(5) for descriptions of the following attributes:
448 ATTRIBUTE TYPE ATTRIBUTE VALUE
450 Interface Stability Committed
455 \fBpasswd\fR(1), \fBprofiles\fR(1), \fBroles\fR(1), \fBusers\fR(1B),
456 \fBgroupadd\fR(1M), \fBgroupdel\fR(1M), \fBgroupmod\fR(1M), \fBgrpck\fR(1M),
457 \fBlogins\fR(1M), \fBpwck\fR(1M), \fBuserdel\fR(1M), \fBusermod\fR(1M),
458 \fBgetdate\fR(3C), \fBauth_attr\fR(4), \fBpasswd\fR(4), \fBprof_attr\fR(4),
459 \fBproject\fR(4), \fBuser_attr\fR(4), \fBattributes\fR(5), \fBzfs\fR(1M)
462 In case of an error, \fBuseradd\fR prints an error message and exits with a
466 The following indicates that \fBlogin\fR specified is already in use:
470 UX: useradd: ERROR: login is already in use. Choose another.
477 The following indicates that the \fIuid\fR specified with the \fB-u\fR option
482 UX: useradd: ERROR: uid \fIuid\fR is already in use. Choose another.
489 The following indicates that the \fIgroup\fR specified with the \fB-g\fR option
494 UX: useradd: ERROR: group \fIgroup\fR does not exist. Choose another.
501 The following indicates that the \fIuid\fR specified with the \fB-u\fR option
502 is in the range of reserved \fBUID\fRs (from \fB0\fR-\fB99\fR):
506 UX: useradd: WARNING: uid \fIuid\fR is reserved.
513 The following indicates that the \fIuid\fR specified with the \fB-u\fR option
514 exceeds \fBMAXUID\fR as defined in \fB<sys/param.h>\fR:
518 UX: useradd: ERROR: uid \fIuid\fR is too big. Choose another.
525 The following indicates that the \fB/etc/passwd\fR or \fB/etc/shadow\fR files
530 UX: useradd: ERROR: Cannot update system files - login cannot be created.
537 The \fBuseradd\fR utility adds definitions to only the local \fB/etc/group\fR,
538 \fBetc/passwd\fR, \fB/etc/passwd\fR, \fB/etc/shadow\fR, \fB/etc/project\fR, and
539 \fB/etc/user_attr\fR files. If a network name service
540 is being used to supplement the local \fB/etc/passwd\fR file with
541 additional entries, \fBuseradd\fR cannot change information supplied by the
542 network name service. However \fBuseradd\fR will verify the uniqueness of the
543 user name (or role) and user id and the existence of any group names specified
544 against the external name service.