USERADD(8) | System Manager's Manual | USERADD(8) |
useradd
—
useradd |
-D [-F ]
[-b base-dir]
[-e expiry-time]
[-f inactive-time]
[-g gid |
name | =uid ]
[-k skel-dir]
[-L login-class]
[-M home-perm]
[-r
lowuid.. highuid]
[-s shell] |
useradd |
[-moSv ] [-b
base-dir] [-c
comment] [-d
home-dir] [-e
expiry-time] [-f
inactive-time] [-G
secondary-group] [-g
gid | name |
=uid ] [-k
skel-dir] [-L
login-class] [-M
home-perm] [-p
password] [-r
lowuid.. highuid]
[-s shell]
[-u uid]
user |
useradd
utility adds a user to the system, creating
and populating a home directory if necessary. Any skeleton files will be
provided for the new user if they exist in the skel-dir
directory (see the -k
option). Default values for the
base directory, the time of password expiry, the time of account expiry,
primary group, the skeleton directory, the range from which the uid will be
allocated, and default login shell can be provided in the
/etc/usermgmt.conf file, which, if running as root, is
created using the built-in defaults if it does not exist.
The first form of the command shown above (using the
-D
option) sets and displays the defaults for the
useradd
utility.
See user(8) for more
information about EXTENSIONS
.
-b
base-dir-m
option is specified and no
-d
option is specified.-D
-D
will show the
current defaults which will be used by the useradd
utility. Together with one of the options shown for the first version of
the command, -D
will set the default to be the new
value. See
usermgmt.conf(5) for
more information.-e
expiry-time-F
-f
inactive-time-e
option above.-g
gid | groupname |
=uid
-k
skel-dir-L
login-classEXTENSIONS
.-M
home-perm-m
is given. The permission is specified as an
octal number, with or without a leading zero.-r
lowuid..
highuidEXTENSIONS
.-s
shellIn the second form of the command, after setting any defaults, and then reading values from /etc/usermgmt.conf, the following command line options are processed:
-b
base-directory-m
option be
specified.-c
comment-d
home-directory-m
option be specified.-e
expiry-time-f
inactive-time-e
option above.-G
secondary-group-g
gid | name |
=uid
=uid
’, then a uid
and gid will be picked which are both unique and the same, and a line
added to /etc/group to describe the new
group.-k
skeleton directory-L
login-classEXTENSIONS
.-M
home-perm-m
is given. The permission is specified as an
octal number, with or without a leading zero.-m
-o
-p
passwordEXTENSIONS
.-S
EXTENSIONS
.-s
shell-u
uid-v
EXTENSIONS
.Once the information has been verified,
useradd
uses
pwd_mkdb(8) to update the
user database. This is run in the background, and, at very large sites could
take several minutes. Until this update is completed, the password file is
unavailable for other updates and the new information is not available to
programs.
useradd
utility exits 0 on success,
and >0 if an error occurs.
useradd
utility first appeared in
NetBSD 1.5. It is based on the
addnerd package by the same author.
useradd
utility was written by
Alistair G. Crooks ⟨agc@NetBSD.org⟩.
Support for setting permissions of home directories was added by Hubert Feyrer.
January 13, 2009 | NetBSD 9.4 |