xref: /freebsd/usr.sbin/adduser/adduser.8 (revision df7f5d4de4592a8948a25ce01e5bddfbb7ce39dc)
1.\" Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $Id$
26.Dd Jan, 9, 1995
27.Dt ADDUSER 8
28.Os FreeBSD 2.1
29.Sh NAME
30.Nm adduser
31.Nd command for adding new users
32.Sh SYNOPSIS
33.Nm adduser
34.Oo
35.Fl batch Ar username
36.Op Ar group Ns , Ns Op Ar group,...
37.Op Ar fullname
38.Op Ar password
39.Oc
40.Op Fl check_only
41.Op Fl config_create
42.Op Fl dotdir Ar dotdir
43.Op Fl group Ar login_group
44.Op Fl h | help
45.Op Fl home Ar home
46.Op Fl message Ar message_file
47.Op Fl noconfig
48.Op Fl shell Ar shell
49.Op Fl s | silent | q | quiet
50.Op Fl uid Ar uid_start
51.Op Fl v | verbose
52.Sh DESCRIPTION
53.Nm Adduser
54is a simple program for adding new users. Adduser checks
55the passwd, group and shell databases. It creates passwd/group entries,
56HOME-directory, dotfiles and sends the new user a welcome message.
57.Sh RESTRICTIONS
58.Bl -tag -width Ds -compact
59.It Sy username
60Login name. May contain only  lowercase characters or digits. Maximum length
61is 16 characters (see
62.Xr setlogin 2
63BUGS section).
64The reasons for this limit are "Historical".
65Given that people have traditionally wanted to break this
66limit for aesthetic reasons, it's never been of great importance to break
67such a basic fundamental parameter in UNIX.
68You can change
69.Dv UT_NAMESIZE
70in
71.Pa /usr/include/utmp.h
72and recompile the
73world; people have done this and it works, but you will have problems
74with any precompiled programs, or source that assumes the 8-character
75name limit and NIS. The NIS protocol mandates an 8-character username.
76If you need a longer login name for e-mail addresses,
77you can define an alias in
78.Pa /etc/aliases .
79.It Sy fullname
80Firstname and surname.
81The
82.Ql Pa \:
83character is not allowed.
84.It Sy shell
85Only valid shells from the shell database or sliplogin and pppd
86.It Sy uid
87Automatically generated or your choice, must be less than 32000.
88.It Sy gid/login group
89Your choice or automatically generated.
90.It Sy password
91If not empty, password is encoded with
92.Xr crypt 3 .
93.El
94.Sh UNIQUE GROUPS
95Perhaps you're missing what
96.Em can
97be done with this scheme that falls apart
98with most other schemes.  With each user in his/her own group the user can
99safely run with a umask of 002 and have files created in their home directory
100and not worry about others being able to read them.
101.Pp
102For a shared area you create a separate uid/gid (like cvs or ncvs on freefall),
103you place each person that should be able to access this area into that new
104group.
105.Pp
106This model of uid/gid administration allows far greater flexibility than lumping
107users into groups and having to muck with the umask when working in a shared
108area.
109.Pp
110I have been using this model for almost 10 years and found that it works
111for most situations, and has never gotten in the way.  (Rod Grimes)
112.Sh CONFIGURATION
113.Bl -tag -width Ds -compact
114.It Sy 1.
115Read intern variables.
116.It Sy 2.
117Read config file (/etc/adduser.conf)
118.It Sy 3.
119Parse command line options
120.El
121.Sh OPTIONS
122.Bl -tag -width Ds
123.It Sy -batch username [group[,group]...] [fullname] [password]
124Batch mode.
125.It Sy -check_only
126Check /etc/passwd, /etc/group, /etc/shells and exit.
127.It Sy -create_config
128Create new config and message file and exit.
129.It Sy -dotdir Ar directory
130Copy files from
131.Ar directory
132into the HOME-directory of new users,
133.Ql Pa dot.foo
134files renamed to
135.Ql Pa .foo .
136Don't copy files if
137.Ar directory
138specified is equal to
139.Ar no .
140For security make all files writable and readable for owner,
141don't allow group or world to write files and allow only owner
142to read/execute/write
143.Pa .rhost ,
144.Pa .Xauthority ,
145.Pa .kermrc ,
146.Pa .netrc ,
147.Pa Mail ,
148.Pa prv ,
149.Pa iscreen ,
150.Pa term .
151.It Sy -group Ar login_group
152Login group.
153.Ar USER
154means use username as login group.
155.It Sy -help,-h,-?
156Print options and exit.
157.It Sy -home Ar partition
158Default home partition where all users located.
159.It Sy -message Ar file
160Send new users a welcome message.
161Don't send message if
162.Ar file
163equal with
164.Ar no .
165.It Sy -noconfig
166Do not read config file.
167.It Sy -shell Ar shell
168Default shell for new users.
169.It Sy -silent,-s,-quiet,-q
170Few warnings, questions, bug reports.
171.It Sy -uid Ar uid
172Use uid's from
173.Ar uid
174on up.
175.It Sy -verbose,-v
176Many warnings, questions. Recommended for novice users.
177.Sh FORMATS
178.Bl -tag -width Ds -compact
179.Ql Pa #
180is a comment.
181.It Sy config file
182.Nm Adduser
183reads and writes this file.
184See
185.Pa /etc/adduser.conf
186for more details.
187.It Sy message file
188Eval variables in this file. See
189.Pa /etc/adduser.message
190for more
191details.
192.El
193.Sh EXAMPLES
194.Pp
195$ adduser
196.Pp
197Start adduser in interactive mode.
198.Pp
199$ adduser -batch baerenklau guest,staff,baer 'Teddy II' qwerty7
200.Pp
201Create user 'baerenklau' and  login group 'baerenklau'. Invite user
202baerenklau into groups guest, staff and baer. Realname (fullname)
203is 'Teddy II'. Password is 'qwerty7' (don't use such passwords!). Create
204HOME directory
205.Pa /home/baerenklau
206and copy all files and directories
207from
208.Pa /usr/share/skel
209to
210.Pa /home/baerenklau .
211Send user baerenklau
212a welcome message.
213.Pp
214$ adduser -uid 5000 -group guest -message no -batch vehlefanz
215.Pp
216Create user 'vehlefanz'. Login group is guest. Uid next available uid
217after 5000, for instance 5007. No other groups, no realname, no password.
218Do not send a welcome message.
219.Sh FILES
220.Bl -tag -width /etc/master.passwdxx -compact
221.It Pa /etc/master.passwd
222user database
223.It Pa /etc/group
224group database
225.It Pa /etc/shells
226shell database
227.It Pa /etc/adduser.conf
228config file for adduser
229.It Pa /etc/adduser.message
230message file for adduser
231.It Pa /usr/share/skel
232skeletal login directory
233.It Pa /var/log/adduser
234logfile for adduser
235.El
236.Sh SEE ALSO
237.Xr chpass 1 ,
238.Xr finger 1 ,
239.Xr passwd 1 ,
240.Xr setlogin 2 ,
241.Xr yp 4 ,
242.Xr aliases 5 ,
243.Xr group 5 ,
244.Xr passwd 5 ,
245.Xr shells 5 ,
246.Xr addgroup 8 ,
247.Xr pwd_mkdb 8 ,
248.Xr rmgroup 8 ,
249.Xr rmuser 8 ,
250.Xr vipw 8
251.\" .Sh BUGS
252.Sh HISTORY
253The
254.Nm
255command appeared in
256.Fx 2.1 .
257