xref: /freebsd/usr.sbin/adduser/adduser.8 (revision ce834215a70ff69e7e222827437116eee2f9ac6f)
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: adduser.8,v 1.20 1997/05/01 22:55:58 ache Exp $
26.Dd January 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 class
38.Op Ar fullname
39.Op Ar password
40.Oc
41.br
42.Op Fl check_only
43.br
44.Op Fl class Ar login_class
45.br
46.Op Fl config_create
47.br
48.Op Fl dotdir Ar dotdir
49.br
50.Op Fl group Ar login_group
51.br
52.Op Fl h | help
53.br
54.Op Fl home Ar home
55.br
56.Op Fl message Ar message_file
57.br
58.Op Fl noconfig
59.br
60.Op Fl shell Ar shell
61.br
62.Op Fl s | silent | q | quiet
63.br
64.Op Fl uid Ar uid_start
65.br
66.Op Fl v | verbose
67.Sh DESCRIPTION
68.Nm Adduser
69is a simple program for adding new users. Adduser checks
70the passwd, group and shell databases. It creates passwd/group entries,
71HOME-directory, dotfiles and sends the new user a welcome message.
72.Sh RESTRICTIONS
73.Bl -tag -width Ds -compact
74.It Sy username
75Login name. May contain only  lowercase characters or digits. Maximum length
76is 16 characters (see
77.Xr setlogin 2
78BUGS section).
79The reasons for this limit are "Historical".
80Given that people have traditionally wanted to break this
81limit for aesthetic reasons, it's never been of great importance to break
82such a basic fundamental parameter in UNIX.
83You can change
84.Dv UT_NAMESIZE
85in
86.Pa /usr/include/utmp.h
87and recompile the
88world; people have done this and it works, but you will have problems
89with any precompiled programs, or source that assumes the 8-character
90name limit and NIS. The NIS protocol mandates an 8-character username.
91If you need a longer login name for e-mail addresses,
92you can define an alias in
93.Pa /etc/aliases .
94.It Sy fullname
95Firstname and surname.
96The
97.Ql Pa \:
98character is not allowed.
99.It Sy shell
100Only valid shells from the shell database or sliplogin and pppd
101.It Sy uid
102Automatically generated or your choice, must be less than 32000.
103.It Sy gid/login group
104Your choice or automatically generated.
105.It Sy password
106If not empty, password is encoded with
107.Xr crypt 3 .
108.El
109.Sh UNIQUE GROUPS
110Perhaps you're missing what
111.Em can
112be done with this scheme that falls apart
113with most other schemes.  With each user in his/her own group the user can
114safely run with a umask of 002 and have files created in their home directory
115and not worry about others being able to read them.
116.Pp
117For a shared area you create a separate uid/gid (like cvs or ncvs on freefall),
118you place each person that should be able to access this area into that new
119group.
120.Pp
121This model of uid/gid administration allows far greater flexibility than lumping
122users into groups and having to muck with the umask when working in a shared
123area.
124.Pp
125I have been using this model for almost 10 years and found that it works
126for most situations, and has never gotten in the way.  (Rod Grimes)
127.Sh CONFIGURATION
128.Bl -tag -width Ds -compact
129.It Sy 1.
130Read intern variables.
131.It Sy 2.
132Read config file (/etc/adduser.conf)
133.It Sy 3.
134Parse command line options
135.El
136.Sh OPTIONS
137.Bl -tag -width Ds
138.It Sy -batch username [group[,group]...] [class] [fullname] [password]
139Batch mode.
140.It Sy -check_only
141Check /etc/passwd, /etc/group, /etc/shells and exit.
142.It Sy -class Ar login_class
143Set default login class
144.It Sy -create_config
145Create new config and message file and exit.
146.It Sy -dotdir Ar directory
147Copy files from
148.Ar directory
149into the HOME-directory of new users,
150.Ql Pa dot.foo
151files renamed to
152.Ql Pa .foo .
153Don't copy files if
154.Ar directory
155specified is equal to
156.Ar no .
157For security make all files writable and readable for owner,
158don't allow group or world to write files and allow only owner
159to read/execute/write
160.Pa .rhost ,
161.Pa .Xauthority ,
162.Pa .kermrc ,
163.Pa .netrc ,
164.Pa Mail ,
165.Pa prv ,
166.Pa iscreen ,
167.Pa term .
168.It Sy -group Ar login_group
169Login group.
170.Ar USER
171means use username as login group.
172.It Sy -help,-h,-?
173Print options and exit.
174.It Sy -home Ar partition
175Default home partition where all users located.
176.It Sy -message Ar file
177Send new users a welcome message.
178Don't send message if
179.Ar file
180equal with
181.Ar no .
182.It Sy -noconfig
183Do not read config file.
184.It Sy -shell Ar shell
185Default shell for new users.
186.It Sy -silent,-s,-quiet,-q
187Few warnings, questions, bug reports.
188.It Sy -uid Ar uid
189Use uid's from
190.Ar uid
191on up.
192.It Sy -verbose,-v
193Many warnings, questions. Recommended for novice users.
194.Sh FORMATS
195.Bl -tag -width Ds -compact
196.Ql Pa #
197is a comment.
198.It Sy config file
199.Nm Adduser
200reads and writes this file.
201See
202.Pa /etc/adduser.conf
203for more details.
204.It Sy message file
205Eval variables in this file. See
206.Pa /etc/adduser.message
207for more
208details.
209.El
210.Sh EXAMPLES
211.Pp
212$ adduser
213.Pp
214Start adduser in interactive mode.
215.Pp
216$ adduser -batch baerenklau guest,staff,baer '' 'Teddy II' qwerty7
217.Pp
218Create user 'baerenklau' and  login group 'baerenklau'. Invite user
219baerenklau into groups guest, staff and baer. Use default login class.
220Realname (fullname)
221is 'Teddy II'. Password is 'qwerty7' (don't use such passwords!). Create
222HOME directory
223.Pa /home/baerenklau
224and copy all files and directories
225from
226.Pa /usr/share/skel
227to
228.Pa /home/baerenklau .
229Send user baerenklau
230a welcome message.
231.Pp
232$ adduser -uid 5000 -group guest -message no -batch vehlefanz
233.Pp
234Create user 'vehlefanz'. Login group is guest. Uid next available uid
235after 5000, for instance 5007. No other groups, no realname, no password.
236Do not send a welcome message.
237.Sh FILES
238.Bl -tag -width /etc/master.passwdxx -compact
239.It Pa /etc/master.passwd
240user database
241.It Pa /etc/group
242group database
243.It Pa /etc/shells
244shell database
245.It Pa /etc/login.conf
246login classes database
247.It Pa /etc/adduser.conf
248config file for adduser
249.It Pa /etc/adduser.message
250message file for adduser
251.It Pa /usr/share/skel
252skeletal login directory
253.It Pa /var/log/adduser
254logfile for adduser
255.El
256.Sh SEE ALSO
257.Xr chpass 1 ,
258.Xr finger 1 ,
259.Xr passwd 1 ,
260.Xr setlogin 2 ,
261.Xr yp 4 ,
262.Xr aliases 5 ,
263.Xr group 5 ,
264.Xr login.conf 5 ,
265.Xr passwd 5 ,
266.Xr shells 5 ,
267.Xr addgroup 8 ,
268.Xr pwd_mkdb 8 ,
269.Xr rmgroup 8 ,
270.Xr rmuser 8 ,
271.Xr vipw 8
272.\" .Sh BUGS
273.Sh HISTORY
274The
275.Nm
276command appeared in
277.Fx 2.1 .
278