ADDUSER(8) | MidnightBSD System Manager's Manual | ADDUSER(8) |
adduser
— command
for adding new users
adduser |
[-CDENShq ] [-G
groups] [-L
login_class] [-M
mode] [-d
partition] [-f
file] [-g
login_group] [-k
dotdir] [-m
message_file] [-s
shell] [-u
uid_start] [-w
type] |
The adduser
utility is a shell script,
implemented around the pw(8)
command, for adding new users. It creates passwd/group entries, a home
directory, copies dotfiles and sends the new user a welcome message. It
supports two modes of operation. It may be used interactively at the command
line to add one user at a time, or it may be directed to get the list of new
users from a file and operate in batch mode without requiring any user
interaction.
-
’
character. Maximum length is 16 characters. The reasons for this limit are
historical. Given that people have traditionally wanted to break this
limit for aesthetic reasons, it has never been of great importance to
break such a basic fundamental parameter in UNIX.
You can change UT_NAMESIZE
in
<utmp.h>
and recompile the
world; people have done this and it works, but you will have problems with
any precompiled programs, or source that assumes the 8-character name
limit, such as NIS. The NIS protocol mandates an 8-character username. If
you need a longer login name for e-mail addresses, you can define an alias
in /etc/mail/aliases.:
’ character
is not allowed.-S
argument is supplied only valid
shells from the shell database (/etc/shells) are
allowed. In addition, either the base name or the full path of the shell
may be supplied.Perhaps you are missing what can be done with this scheme that falls apart with most other schemes. With each user in their own group, they can safely run with a umask of 002 instead of the usual 022 and create files in their home directory without worrying about others being able to change them.
For a shared area you create a separate UID/GID, you place each person that should be able to access this area into that new group.
This model of UID/GID administration allows far greater flexibility than lumping users into groups and having to muck with the umask when working in a shared area.
I have been using this model for almost 10 years and found that it works for most situations, and has never gotten in the way. (Rod Grimes)
The adduser
utility reads its
configuration information from /etc/adduser.conf. If
this file does not exist, it will use predefined defaults. While this file
may be edited by hand, the safer option is to use the
-C
command line argument. With this argument,
adduser
will start interactive input, save the
answers to its prompts in /etc/adduser.conf, and
promptly exit without modifying the user database. Options specified on the
command line will take precedence over any values saved in this file.
-C
-f
option.-d
partitionadduser
script will not
create and populate a home directory by that name. Otherwise, by default
it attempts to create a home directory.-D
-E
*LOCKED*
” to the password
field. The account may be unlocked by the super-user with the
pw(8) command:
pw
unlock
[name |
uid]-f
file-
”,
then get the list from standard input. If this option is specified,
adduser
will operate in batch mode and will not
seek any user input. If an error is encountered while processing an
account, it will write a message to standard error and move to the next
account. The format of the input file is described below.-g
login_group-G
groups-h
-k
directory-L
login_class-m
fileno
for
file causes no message to be sent to new users.
Please note that the message file can reference the internal variables of
the adduser
script.-M
mode-N
-q
-s
shell-S
argument is supplied the shell must exist in
/etc/shells or be the special shell
nologin
to be considered a valid shell.-S
-u
uid-w
typeadduser
utility allows the user
to specify what type of password to create. The type
argument may have one of the following values:
no
*
’
character. The user may not log in until the super-user manually
enables the password.none
yes
random
When the -f
option is used, the account
information must be stored in a specific format. All empty lines or lines
beginning with a ‘#
’ will be ignored.
All other lines must contain ten colon
(‘:
’) separated fields as described
below. Command line options do not take precedence over values in the
fields. Only the password field may contain a
‘:
’ character as part of the
string.
-p
argument to
pw(8). It may be
dd-mmm-yy[yy],
where dd is for the day, mmm
is for the month in numeric or alphabetical format:
“10
” or
“Oct
”, and
yy[yy] is the four or two
digit year. To denote a time relative to the current date the format is:
+n[mhdwoy],
where n denotes a number, followed by the minutes,
hours, days, weeks, months or years after which the password must be
changed. This field may be left empty to turn it off.yes
and this field is empty, it is assumed the
account will have an empty password. If the password type is
random
and this field is
not empty, its
contents will be used as a password. This field will be ignored if the
-w
option is used with a
no
or none
argument. Be
careful not to terminate this field with a closing
‘:
’ because it will be treated as
part of the password.adduser
adduser
adduser
chpass(1), passwd(1), adduser.conf(5), aliases(5), group(5), login.conf(5), passwd(5), shells(5), pw(8), pwd_mkdb(8), rmuser(8), vipw(8), yp(8)
The adduser
command appeared in
FreeBSD 2.1.
This manual page and the original script, in Perl, was written by Wolfram Schneider <wosch@FreeBSD.org>. The replacement script, written as a Bourne shell script with some enhancements, and the man page modification that came with it were done by Mike Makonnen <mtm@identd.net>.
In order for adduser
to correctly expand
variables such as $username and
$randompass in the message sent to new users, it must
let the shell evaluate each line of the message file. This means that shell
commands can also be embedded in the message file. The
adduser
utility attempts to mitigate the possibility
of an attacker using this feature by refusing to evaluate the file if it is
not owned and writable only by the root user. In addition, shell special
characters and operators will have to be escaped when used in the message
file.
Also, password ageing and account expiry times are currently settable only in batch mode or when specified in /etc/adduser.conf. The user should be able to set them in interactive mode as well.
September 15, 2012 | midnightbsd-3.1 |