shadow/man/useradd.8.xml

418 lines
15 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<refentry id='useradd.8'>
<!-- $Id: useradd.8.xml,v 1.6 2005/04/27 18:20:35 kloczek Exp $ -->
<refmeta>
<refentrytitle>useradd</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv id='name'>
<refname>useradd</refname>
<refpurpose>Create a new user or update default new user information</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>useradd</command>
<arg choice='opt'>-c <replaceable>comment</replaceable></arg>
<arg choice='opt'>-d <replaceable>home_dir</replaceable></arg>
<arg choice='opt'>-e <replaceable>expire_date</replaceable></arg>
<arg choice='opt'>-f <replaceable>inactive_days</replaceable></arg>
<sbr/>
<arg choice='opt'>-g <replaceable>initial_group</replaceable></arg>
<arg choice='opt'>
<arg choice='plain'>-G <replaceable>group1</replaceable></arg>
<arg choice='opt'>
<arg choice='plain' rep='repeat'>
<replaceable>,group2,</replaceable>
</arg>
<arg choice='plain'>
<replaceable>,</replaceable>
</arg>
<arg choice='opt'>
<replaceable>groupN</replaceable>
</arg>
</arg>
</arg>
<sbr/>
<arg choice='opt'>
<arg choice='opt'>-M </arg><arg choice='plain'>-m </arg>
<arg choice='opt'>-k <replaceable>skeleton_dir</replaceable></arg>
</arg>
<arg choice='opt'>-o </arg>
<arg choice='opt'>-p <replaceable>passwd</replaceable></arg>
<arg choice='opt'>-s <replaceable>shell</replaceable></arg>
<sbr/>
<arg choice='opt'>-u <replaceable>uid</replaceable></arg>
<arg choice='plain'><replaceable>login</replaceable></arg>
<arg choice='plain'><replaceable>useradd</replaceable></arg>
<arg choice='plain'>-D </arg>
<arg choice='opt'>-g <replaceable>group</replaceable></arg>
<arg choice='opt'>-b <replaceable>home_dir</replaceable></arg>
<arg choice='opt'>-e <replaceable>expire_date</replaceable></arg>
<sbr/>
<arg choice='opt'>-f <replaceable>inactive_days</replaceable></arg>
<arg choice='opt'>-s <replaceable>shell</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'>
<title>DESCRIPTION</title>
<refsect2 id='creating_new_users'>
<title>Creating New Users</title>
<para>
When invoked without the <option>-D</option> option, the
<command>useradd</command> 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.
</para>
</refsect2>
</refsect1>
<refsect1 id='options'>
<title>OPTIONS</title>
<para>The options which apply to the <command>useradd</command> command are:
</para>
<variablelist remap='IP'>
<varlistentry>
<term>
<option>-c</option> <replaceable>comment</replaceable>
</term>
<listitem>
<para>The new user's password file comment field.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-d</option> <replaceable>home_dir</replaceable>
</term>
<listitem>
<para>
The new user will be created using <emphasis remap='I'> home_dir
</emphasis>as the value for the user's login directory. The
default is to append the <emphasis remap='I'>login</emphasis>
name to <emphasis remap='I'>home</emphasis> and use that as the
login directory name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-e</option> <replaceable>expire_date</replaceable>
</term>
<listitem>
<para>The date on which the user account will be disabled. The
date is specified in the format <emphasis
remap='I'>YYYY-MM-DD</emphasis>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-f</option> <replaceable>inactive_days</replaceable>
</term>
<listitem>
<para>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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-g</option> <replaceable>initial_group</replaceable>
</term>
<listitem>
<para>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
<filename>/etc/default/useradd</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-G</option> <replaceable>group1</replaceable>[<emphasis remap='I'>
,group2,...,
</emphasis>
[<emphasis remap='I'>groupN</emphasis>]]]
</term>
<listitem>
<para>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
<option>-g</option> option. The default is for the user to
belong only to the initial group.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-M</option>
</term>
<listitem>
<para>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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-m</option>
</term>
<listitem>
<para>The user's home directory will be created if it does not
exist. The files contained in <emphasis
remap='I'>skeleton_dir</emphasis> will be copied to the home
directory if the <option>-k</option> option is used, otherwise
the files contained in <filename>/etc/skel</filename> will be
used instead. Any directories contained in <emphasis remap='I'>
skeleton_dir</emphasis> or <filename>/etc/skel</filename> will
be created in the user's home directory as well. The
<option>-k</option> option is only valid in conjunction with the
<option>-m</option> option. The default is to not create the
directory and to not copy any files.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-o</option>
</term>
<listitem>
<para>Allow create user with duplicate (non-unique) UID.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-p</option> <replaceable>passwd</replaceable>
</term>
<listitem>
<para>
The encrypted password, as returned by <citerefentry>
<refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>. The default is to disable the account.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-s</option> <replaceable>shell</replaceable>
</term>
<listitem>
<para>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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-u</option> <replaceable>uid</replaceable>
</term>
<listitem>
<para>The numerical value of the user's ID. This value must be
unique, unless the <option>-o</option> 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.
</para>
</listitem>
</varlistentry>
</variablelist>
<refsect2 id='changing_the_default_values'>
<title>Changing the default values</title>
<para>
When invoked with the <option>-D</option> option,
<command>useradd</command> will either display the current default
values, or update the default values from the command line. The
valid options are
</para>
<variablelist remap='IP'>
<varlistentry>
<term>
<option>-b</option> <replaceable>home_dir</replaceable>
</term>
<listitem>
<para>The initial path prefix for a new user's home directory.
The user's name will be affixed to the end of <emphasis
remap='I'>home</emphasis> to create the new directory name if
the <option>-d</option> option is not used when creating a new
account.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-e</option> <replaceable>expire_date</replaceable>
</term>
<listitem>
<para>The date on which the user account is disabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-f</option> <replaceable>inactive</replaceable>
</term>
<listitem>
<para>The number of days after a password has expired before the
account will be disabled.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-g</option> <replaceable>group</replaceable>
</term>
<listitem>
<para>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 .
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-s</option> <replaceable>shell</replaceable>
</term>
<listitem>
<para>The name of the new user's login shell. The named program
will be used for all future new user accounts.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>If no options are specified, <command>useradd</command>
displays the current default values.
</para>
</refsect2>
</refsect1>
<refsect1 id='notes'>
<title>NOTES</title>
<para>The system administrator is responsible for placing the default
user files in the <filename>/etc/skel/</filename> directory.
</para>
</refsect1>
<refsect1 id='caveats'>
<title>CAVEATS</title>
<para>You may not add a user to an NIS group. This must be performed on
the NIS server.
</para>
</refsect1>
<refsect1 id='files'>
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>/etc/passwd</filename></term>
<listitem>user account information</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/shadow</filename></term>
<listitem>secure user account information</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/group</filename></term>
<listitem>group account information</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/default/useradd</filename></term>
<listitem>default information</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/skel/</filename></term>
<listitem>directory containing default files</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='exit_values'>
<title>EXIT VALUES</title>
<variablelist remap='TP'>
<varlistentry>
<term>
The <command>useadd</coamand> command exits with the following
values:
</term>
<listitem>
<!-- .br -->
<para>
<literal>0</literal> - success
<!-- .br -->
<literal>1</literal> - can't update password file
<!-- .br -->
<literal>2</literal> - invalid command syntax
<!-- .br -->
<literal>3</literal> - invalid argument to option
<!-- .br -->
<literal>4</literal> - uid already in use (and no -o)
<!-- .br -->
<literal>6</literal> - specified group doesn't exist
<!-- .br -->
<literal>9</literal> - username already in use
<!-- .br -->
<literal>10</literal> - can't update group file
<!-- .br -->
<literal>12</literal> - can't create home directory
<!-- .br -->
<literal>13</literal> - can't create mail spool
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='see_also'>
<title>SEE ALSO</title>
<para>
<citerefentry>
<refentrytitle>chfn</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupdel</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>groupmod</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>userdel</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>usermod</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>
</para>
</refsect1>
<refsect1 id='author'>
<title>AUTHOR</title>
<para>Julianne Frances Haugh (jockgrrl@ix.netcom.com)</para>
</refsect1>
</refentry>