2007-10-07 17:15:23 +05:30
|
|
|
.\"$Id: useradd.8,v 1.18 2003/05/07 14:04:53 kloczek Exp $
|
2007-10-07 17:14:44 +05:30
|
|
|
.\" Copyright 1991 - 1994, Julianne Frances Haugh
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. Neither the name of Julianne F. Haugh nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.TH USERADD 8
|
|
|
|
.SH NAME
|
|
|
|
useradd \- Create a new user or update default new user information
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.TP 8
|
2007-10-07 17:14:51 +05:30
|
|
|
\fBuseradd\fR [\fB-c\fR \fIcomment\fR] [\fB-d\fR \fIhome_dir\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:14:51 +05:30
|
|
|
[\fB-e\fR \fIexpire_date\fR] [\fB-f\fR \fIinactive_time\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:14:51 +05:30
|
|
|
[\fB-g\fR \fIinitial_group\fR] [\fB-G\fR \fIgroup\fR[,...]]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:23 +05:30
|
|
|
[[\fB-M\fR] \fB-m\fR [\fB-k\fR \fIskeleton_dir\fR]] [\fB-o\fR] [\fB-p\fR \fIpasswd\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:14:59 +05:30
|
|
|
[\fB-s\fR \fIshell\fR] [\fB-u\fR \fIuid\fR] \fIlogin\fR
|
2007-10-07 17:14:44 +05:30
|
|
|
.TP 8
|
2007-10-07 17:14:51 +05:30
|
|
|
\fBuseradd\fR \fB-D\fR [\fB-g\fI default_group\fR] [\fB-b\fI default_home\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:14:59 +05:30
|
|
|
[\fB-e\fI default_expire_date\fR] [\fB-f\fI default_inactive\fR]
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
|
|
|
[\fB-s\fI default_shell\fR]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.SS Creating New Users
|
2007-10-07 17:15:23 +05:30
|
|
|
When invoked without the \fB-D\fR option, the \fBuseradd\fR command creates
|
|
|
|
a new user account using the values specified on the command line and the
|
|
|
|
default values from the system. The new user account will be entered into
|
|
|
|
the system files as needed, the home directory will be created, and initial
|
|
|
|
files copied, depending on the command line options. The options which apply
|
|
|
|
to the \fBuseradd\fR command are:
|
|
|
|
.IP "\fB-c\fR \fIcomment\fR"
|
2007-10-07 17:14:44 +05:30
|
|
|
The new user's password file comment field.
|
2007-10-07 17:15:23 +05:30
|
|
|
.IP "\fB-d\fR \fIhome_dir\fR"
|
|
|
|
The new user will be created using \fIhome_dir\fR as the value for the
|
|
|
|
user's login directory. The default is to append the \fIlogin\fR name to
|
|
|
|
\fIdefault_home\fR and use that as the login directory name.
|
|
|
|
.IP "\fB-e\fR \fIexpire_date\fR"
|
|
|
|
The date on which the user account will be disabled. The date is specified
|
|
|
|
in the format \fIYYYY-MM-DD\fR.
|
|
|
|
.IP "\fB-f\fR \fIinactive_days\fR"
|
|
|
|
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.
|
|
|
|
.IP "\fB-g\fR \fIinitial_group\fR"
|
|
|
|
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
|
2007-10-07 17:15:14 +05:30
|
|
|
\fI/etc/default/useradd\fR.
|
2007-10-07 17:15:23 +05:30
|
|
|
.IP "\fB-G\fR \fIgroup,[...]\fR"
|
|
|
|
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
|
|
|
|
\fB-g\fR option. The default is for the user to belong only to the initial
|
|
|
|
group.
|
|
|
|
.IP \fB-M\fR
|
|
|
|
RedHat added the CREATE_HOME option in login.defs in their version of
|
|
|
|
shadow-utils (which makes -m the default, with new -M option to turn it
|
|
|
|
off). Unfortunately, this changes the way useradd works (it can be run by
|
|
|
|
scripts expecting some standard behaviour), compared to other Unices and
|
|
|
|
other Linux distributions, and also adds a lot of confusion.
|
2007-10-07 17:14:44 +05:30
|
|
|
.IP \fB-m\fR
|
2007-10-07 17:15:23 +05:30
|
|
|
The user's home directory will be created if it does not exist. The files
|
|
|
|
contained in \fIskeleton_dir\fR will be copied to the home directory if the
|
|
|
|
\fB-k\fR option is used, otherwise the files contained in \fI/etc/skel\fR
|
|
|
|
will be used instead. Any directories contained in \fIskeleton_dir\fR or
|
|
|
|
\fI/etc/skel\fR will be created in the user's home directory as well. The
|
|
|
|
\fB-k\fR option is only valid in conjunction with the \fB-m\fR option. The
|
|
|
|
default is to not create the directory and to not copy any files.
|
2007-10-07 17:14:59 +05:30
|
|
|
.IP "\fB-o\fR"
|
|
|
|
Allow create user with duplicate (non-unique) UID.
|
2007-10-07 17:14:44 +05:30
|
|
|
.IP "\fB-p \fIpasswd\fR"
|
2007-10-07 17:15:23 +05:30
|
|
|
The encrypted password, as returned by \fBcrypt\fR(3). The default is to
|
|
|
|
disable the account.
|
|
|
|
.IP "\fB-s\fR \fIshell\fR"
|
|
|
|
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.
|
2007-10-07 17:14:44 +05:30
|
|
|
.IP "\fB-u \fIuid\fR"
|
2007-10-07 17:15:23 +05:30
|
|
|
The numerical value of the user's ID. This value must be unique, unless the
|
|
|
|
\fI-o\fR option is used. The value must be non-negative. The default is to
|
|
|
|
use the smallest ID value greater than 99 and greater than every other user.
|
2007-10-07 17:14:44 +05:30
|
|
|
Values between 0 and 99 are typically reserved for system accounts.
|
|
|
|
.SS Changing the default values
|
2007-10-07 17:15:23 +05:30
|
|
|
When invoked with the \fB-D\fR option, \fBuseradd\fR will either display the
|
|
|
|
current default values, or update the default values from the command line.
|
2007-10-07 17:14:44 +05:30
|
|
|
The valid options are
|
2007-10-07 17:15:23 +05:30
|
|
|
.IP "\fB-b\fR \fIdefault_home\fR"
|
|
|
|
The initial path prefix for a new user's home directory. The user's name
|
|
|
|
will be affixed to the end of \fIdefault_home\fR to create the new directory
|
|
|
|
name if the \fB-d\fI option is not used when creating a new account.
|
|
|
|
.IP "\fB-e\fR \fIdefault_expire_date\fR"
|
2007-10-07 17:14:44 +05:30
|
|
|
The date on which the user account is disabled.
|
2007-10-07 17:15:23 +05:30
|
|
|
.IP "\fB-f\fR \fIdefault_inactive\fR"
|
|
|
|
The number of days after a password has expired before the account will be
|
|
|
|
disabled.
|
|
|
|
.IP "\fB-g\fR \fIdefault_group\fR"
|
|
|
|
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 .
|
|
|
|
.IP "\fB-s\fR \fIdefault_shell\fR"
|
|
|
|
The name of the new user's login shell. The named program will be used for
|
|
|
|
all future new user accounts.
|
2007-10-07 17:14:44 +05:30
|
|
|
.PP
|
2007-10-07 17:15:23 +05:30
|
|
|
If no options are specified, \fBuseradd\fR displays the current default
|
|
|
|
values.
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH NOTES
|
2007-10-07 17:15:23 +05:30
|
|
|
The system administrator is responsible for placing the default user files
|
|
|
|
in the \fI/etc/skel/\fR directory.
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH CAVEATS
|
2007-10-07 17:15:23 +05:30
|
|
|
You may not add a user to an NIS group. This must be performed on the NIS
|
|
|
|
server.
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH FILES
|
2007-10-07 17:15:23 +05:30
|
|
|
\fI/etc/passwd\fR \- user account information
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:23 +05:30
|
|
|
\fI/etc/shadow\fR \- secure user account information
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:23 +05:30
|
|
|
\fI/etc/group\fR \- group information
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:23 +05:30
|
|
|
\fI/etc/default/useradd\fR \- default information
|
2007-10-07 17:14:44 +05:30
|
|
|
.br
|
2007-10-07 17:15:23 +05:30
|
|
|
\fI/etc/skel/\fR \- directory containing default files
|
|
|
|
.SH EXIT VALUES
|
|
|
|
.TP 2
|
|
|
|
The \fBuseadd\fR command exits with the following values:
|
|
|
|
.br
|
|
|
|
\fB0\fR \- success
|
|
|
|
.br
|
|
|
|
\fB1\fR \- can't update password file
|
|
|
|
.br
|
|
|
|
\fB2\fR \- invalid command syntax
|
|
|
|
.br
|
|
|
|
\fB3\fR \- invalid argument to option
|
|
|
|
.br
|
|
|
|
\fB4\fR \- uid already in use (and no -o)
|
|
|
|
.br
|
|
|
|
\fB6\fR \- specified group doesn't exist
|
|
|
|
.br
|
|
|
|
\fB9\fR \- username already in use
|
|
|
|
.br
|
|
|
|
\fB10\fR \- can't update group file
|
|
|
|
.br
|
|
|
|
\fB12\fR \- can't create home directory
|
|
|
|
.br
|
|
|
|
\fB13\fR \- can't create mail spool
|
2007-10-07 17:14:44 +05:30
|
|
|
.SH SEE ALSO
|
|
|
|
.BR chfn (1),
|
|
|
|
.BR chsh (1),
|
2007-10-07 17:15:14 +05:30
|
|
|
.BR passwd (1),
|
2007-10-07 17:14:44 +05:30
|
|
|
.BR crypt (3),
|
|
|
|
.BR groupadd (8),
|
|
|
|
.BR groupdel (8),
|
|
|
|
.BR groupmod (8),
|
|
|
|
.BR userdel (8),
|
|
|
|
.BR usermod (8)
|
|
|
|
.SH AUTHOR
|
|
|
|
Julianne Frances Haugh (jockgrrl@ix.netcom.com)
|