xref: /freebsd/usr.sbin/pw/pw.8 (revision 4731d0764ab6d8e668a19c10e9412dd144f66bfa)
1db34a710SJoerg Wunsch.\" Copyright (C) 1996
2db34a710SJoerg Wunsch.\" David L. Nugent.  All rights reserved.
3d6f907dcSJoerg Wunsch.\"
49fd0dafcSJoerg Wunsch.\" Redistribution and use in source and binary forms, with or without
59fd0dafcSJoerg Wunsch.\" modification, are permitted provided that the following conditions
69fd0dafcSJoerg Wunsch.\" are met:
79fd0dafcSJoerg Wunsch.\" 1. Redistributions of source code must retain the above copyright
89fd0dafcSJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer.
99fd0dafcSJoerg Wunsch.\" 2. Redistributions in binary form must reproduce the above copyright
109fd0dafcSJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer in the
119fd0dafcSJoerg Wunsch.\"    documentation and/or other materials provided with the distribution.
12d6f907dcSJoerg Wunsch.\"
13db34a710SJoerg Wunsch.\" THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND
149fd0dafcSJoerg Wunsch.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159fd0dafcSJoerg Wunsch.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16db34a710SJoerg Wunsch.\" ARE DISCLAIMED.  IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE
179fd0dafcSJoerg Wunsch.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
189fd0dafcSJoerg Wunsch.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199fd0dafcSJoerg Wunsch.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
209fd0dafcSJoerg Wunsch.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
219fd0dafcSJoerg Wunsch.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
229fd0dafcSJoerg Wunsch.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
239fd0dafcSJoerg Wunsch.\" SUCH DAMAGE.
249fd0dafcSJoerg Wunsch.\"
2597d92980SPeter Wemm.\" $FreeBSD$
269fd0dafcSJoerg Wunsch.\"
279fd0dafcSJoerg Wunsch.Dd December 9, 1996
28d6f907dcSJoerg Wunsch.Dt PW 8
29d6f907dcSJoerg Wunsch.Os
30d6f907dcSJoerg Wunsch.Sh NAME
31d6f907dcSJoerg Wunsch.Nm pw
329fd0dafcSJoerg Wunsch.Nd create, remove, modify & display system users and groups
33d6f907dcSJoerg Wunsch.Sh SYNOPSIS
34e97407b4SRuslan Ermilov.Nm
355f12594aSDavid Nugent.Op Fl V Ar etcdir
36d6f907dcSJoerg Wunsch.Ar useradd
37d6f907dcSJoerg Wunsch.Op name|uid
38d6f907dcSJoerg Wunsch.Op Fl C Ar config
39d6f907dcSJoerg Wunsch.Op Fl q
40d6f907dcSJoerg Wunsch.Op Fl n Ar name
41d6f907dcSJoerg Wunsch.Op Fl u Ar uid
42d6f907dcSJoerg Wunsch.Op Fl c Ar comment
43d6f907dcSJoerg Wunsch.Op Fl d Ar dir
44d6f907dcSJoerg Wunsch.Op Fl e Ar date
45d6f907dcSJoerg Wunsch.Op Fl p Ar date
46d6f907dcSJoerg Wunsch.Op Fl g Ar group
47d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist
48d6f907dcSJoerg Wunsch.Op Fl m
49d6f907dcSJoerg Wunsch.Op Fl k Ar dir
50d6f907dcSJoerg Wunsch.Op Fl s Ar shell
51d6f907dcSJoerg Wunsch.Op Fl o
52d6f907dcSJoerg Wunsch.Op Fl L Ar class
53d6f907dcSJoerg Wunsch.Op Fl h Ar fd
549fd0dafcSJoerg Wunsch.Op Fl N
559fd0dafcSJoerg Wunsch.Op Fl P
56f1d684faSDavid Nugent.Op Fl Y
57e97407b4SRuslan Ermilov.Nm
585f12594aSDavid Nugent.Op Fl V Ar etcdir
59d6f907dcSJoerg Wunsch.Ar useradd
60d6f907dcSJoerg Wunsch.Op name|uid
61f1d684faSDavid Nugent.Fl D
62d6f907dcSJoerg Wunsch.Op Fl C Ar config
63d6f907dcSJoerg Wunsch.Op Fl q
64d6f907dcSJoerg Wunsch.Op Fl b Ar dir
65d6f907dcSJoerg Wunsch.Op Fl e Ar days
66d6f907dcSJoerg Wunsch.Op Fl p Ar days
67d6f907dcSJoerg Wunsch.Op Fl g Ar group
68d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist
69d6f907dcSJoerg Wunsch.Op Fl k Ar dir
70610a5778SRuslan Ermilov.Op Fl u Ar min , Ns Ar max
71610a5778SRuslan Ermilov.Op Fl i Ar min , Ns Ar max
72d6f907dcSJoerg Wunsch.Op Fl w Ar method
73d6f907dcSJoerg Wunsch.Op Fl s Ar shell
74f1d684faSDavid Nugent.Op Fl y Ar path
75e97407b4SRuslan Ermilov.Nm
765f12594aSDavid Nugent.Op Fl V Ar etcdir
77d6f907dcSJoerg Wunsch.Ar userdel
78d6f907dcSJoerg Wunsch.Op name|uid
79d6f907dcSJoerg Wunsch.Op Fl n Ar name
80d6f907dcSJoerg Wunsch.Op Fl u Ar uid
81d6f907dcSJoerg Wunsch.Op Fl r
82f1d684faSDavid Nugent.Op Fl Y
83e97407b4SRuslan Ermilov.Nm
845f12594aSDavid Nugent.Op Fl V Ar etcdir
85d6f907dcSJoerg Wunsch.Ar usermod
86d6f907dcSJoerg Wunsch.Op name|uid
87d6f907dcSJoerg Wunsch.Op Fl C Ar config
88d6f907dcSJoerg Wunsch.Op Fl q
89d6f907dcSJoerg Wunsch.Op Fl n Ar name
90d6f907dcSJoerg Wunsch.Op Fl u Ar uid
91d6f907dcSJoerg Wunsch.Op Fl c Ar comment
92d6f907dcSJoerg Wunsch.Op Fl d Ar dir
93d6f907dcSJoerg Wunsch.Op Fl e Ar date
94d6f907dcSJoerg Wunsch.Op Fl p Ar date
95d6f907dcSJoerg Wunsch.Op Fl g Ar group
96d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist
97d6f907dcSJoerg Wunsch.Op Fl l Ar name
98d6f907dcSJoerg Wunsch.Op Fl m
99d6f907dcSJoerg Wunsch.Op Fl k Ar dir
1009fd0dafcSJoerg Wunsch.Op Fl w Ar method
101d6f907dcSJoerg Wunsch.Op Fl s Ar shell
102d6f907dcSJoerg Wunsch.Op Fl L Ar class
103d6f907dcSJoerg Wunsch.Op Fl h Ar fd
1049fd0dafcSJoerg Wunsch.Op Fl N
1059fd0dafcSJoerg Wunsch.Op Fl P
106f1d684faSDavid Nugent.Op Fl Y
107e97407b4SRuslan Ermilov.Nm
1085f12594aSDavid Nugent.Op Fl V Ar etcdir
109d6f907dcSJoerg Wunsch.Ar usershow
110d6f907dcSJoerg Wunsch.Op name|uid
111d6f907dcSJoerg Wunsch.Op Fl n Ar name
112d6f907dcSJoerg Wunsch.Op Fl u Ar uid
113d6f907dcSJoerg Wunsch.Op Fl F
1149fd0dafcSJoerg Wunsch.Op Fl P
1154731d076SDima Dorfman.Op Fl 7
116d6f907dcSJoerg Wunsch.Op Fl a
117e97407b4SRuslan Ermilov.Nm
1185f12594aSDavid Nugent.Op Fl V Ar etcdir
1199fd0dafcSJoerg Wunsch.Ar usernext
1209fd0dafcSJoerg Wunsch.Op Fl C Ar config
1219fd0dafcSJoerg Wunsch.Op Fl q
122e97407b4SRuslan Ermilov.Nm
1235f12594aSDavid Nugent.Op Fl V Ar etcdir
124d6f907dcSJoerg Wunsch.Ar groupadd
125d6f907dcSJoerg Wunsch.Op group|gid
126d6f907dcSJoerg Wunsch.Op Fl C Ar config
127d6f907dcSJoerg Wunsch.Op Fl q
128d6f907dcSJoerg Wunsch.Op Fl n Ar group
129d6f907dcSJoerg Wunsch.Op Fl g Ar gid
1309fd0dafcSJoerg Wunsch.Op Fl M Ar members
131d6f907dcSJoerg Wunsch.Op Fl o
132d6f907dcSJoerg Wunsch.Op Fl h Ar fd
1339fd0dafcSJoerg Wunsch.Op Fl N
1349fd0dafcSJoerg Wunsch.Op Fl P
135f1d684faSDavid Nugent.Op Fl Y
136e97407b4SRuslan Ermilov.Nm
1375f12594aSDavid Nugent.Op Fl V Ar etcdir
138d6f907dcSJoerg Wunsch.Ar groupdel
13906f64964SJoseph Koshy.Op group|gid
140d6f907dcSJoerg Wunsch.Op Fl n Ar name
141d6f907dcSJoerg Wunsch.Op Fl g Ar gid
142f1d684faSDavid Nugent.Op Fl Y
143e97407b4SRuslan Ermilov.Nm
1445f12594aSDavid Nugent.Op Fl V Ar etcdir
145d6f907dcSJoerg Wunsch.Ar groupmod
14606f64964SJoseph Koshy.Op group|gid
147d6f907dcSJoerg Wunsch.Op Fl C Ar config
148d6f907dcSJoerg Wunsch.Op Fl q
149d6f907dcSJoerg Wunsch.Op Fl F
150d6f907dcSJoerg Wunsch.Op Fl n Ar name
151d6f907dcSJoerg Wunsch.Op Fl g Ar gid
152d6f907dcSJoerg Wunsch.Op Fl l Ar name
1539fd0dafcSJoerg Wunsch.Op Fl M Ar members
1549fd0dafcSJoerg Wunsch.Op Fl m Ar newmembers
155d6f907dcSJoerg Wunsch.Op Fl h Ar fd
1569fd0dafcSJoerg Wunsch.Op Fl N
1579fd0dafcSJoerg Wunsch.Op Fl P
158f1d684faSDavid Nugent.Op Fl Y
159e97407b4SRuslan Ermilov.Nm
1605f12594aSDavid Nugent.Op Fl V Ar etcdir
161d6f907dcSJoerg Wunsch.Ar groupshow
16206f64964SJoseph Koshy.Op group|gid
163d6f907dcSJoerg Wunsch.Op Fl n Ar name
164d6f907dcSJoerg Wunsch.Op Fl g Ar gid
165d6f907dcSJoerg Wunsch.Op Fl F
1669fd0dafcSJoerg Wunsch.Op Fl P
167d6f907dcSJoerg Wunsch.Op Fl a
168e97407b4SRuslan Ermilov.Nm
1695f12594aSDavid Nugent.Op Fl V Ar etcdir
1709fd0dafcSJoerg Wunsch.Ar groupnext
1719fd0dafcSJoerg Wunsch.Op Fl C Ar config
1729fd0dafcSJoerg Wunsch.Op Fl q
173e468afb4SDima Dorfman.Nm
174e468afb4SDima Dorfman.Op Fl V Ar etcdir
175e468afb4SDima Dorfman.Ar lock
176e468afb4SDima Dorfman.Op name|uid
177e468afb4SDima Dorfman.Op Fl C Ar config
178e468afb4SDima Dorfman.Op Fl q
179e468afb4SDima Dorfman.Nm
180e468afb4SDima Dorfman.Op Fl V Ar etcdir
181e468afb4SDima Dorfman.Ar unlock
182e468afb4SDima Dorfman.Op name|uid
183e468afb4SDima Dorfman.Op Fl C Ar config
184e468afb4SDima Dorfman.Op Fl q
185d6f907dcSJoerg Wunsch.Sh DESCRIPTION
1861dcc6ec7SPhilippe Charnier.Nm Pw
187d6f907dcSJoerg Wunschis a command-line based editor for the system
1881dcc6ec7SPhilippe Charnier.Ar user
189d6f907dcSJoerg Wunschand
1901dcc6ec7SPhilippe Charnier.Ar group
1913a7e7077SDaniel O'Callaghanfiles, allowing the superuser an easy to use and standardized way of adding,
192d6f907dcSJoerg Wunschmodifying and removing users and groups.
193d6f907dcSJoerg WunschNote that
1941dcc6ec7SPhilippe Charnier.Nm
195137db389SSteve Priceonly operates on the local user and group files.  NIS users and groups must be
196d6f907dcSJoerg Wunschmaintained on the NIS server.
1971dcc6ec7SPhilippe Charnier.Nm Pw
198053375e8SMike Pritchardhandles updating the
199053375e8SMike Pritchard.Pa passwd ,
200053375e8SMike Pritchard.Pa master.passwd ,
201053375e8SMike Pritchard.Pa group
202053375e8SMike Pritchardand the secure and insecure
203d6f907dcSJoerg Wunschpassword database files, and must be run as root.
204d6f907dcSJoerg Wunsch.Pp
205137db389SSteve PriceThe first one or two keywords provided to
206137db389SSteve Price.Nm
207137db389SSteve Priceon the command line provide the context for the remainder of the arguments.
208137db389SSteve PriceThe keywords
209d6f907dcSJoerg Wunsch.Ar user
210d6f907dcSJoerg Wunschand
211d6f907dcSJoerg Wunsch.Ar group
212137db389SSteve Pricemay be combined with
213d6f907dcSJoerg Wunsch.Ar add ,
214d6f907dcSJoerg Wunsch.Ar del ,
2159fd0dafcSJoerg Wunsch.Ar mod ,
216d6f907dcSJoerg Wunsch.Ar show ,
2179fd0dafcSJoerg Wunschor
218137db389SSteve Price.Ar next
2194e86fcacSSheldon Hearnin any order.
2204e86fcacSSheldon Hearn(For example,
221137db389SSteve Price.Ar showuser ,
222137db389SSteve Price.Ar usershow ,
223610a5778SRuslan Ermilov.Ar show user ,
224610a5778SRuslan Ermilovand
225137db389SSteve Price.Ar user show
226137db389SSteve Priceall mean the same thing.)
227137db389SSteve PriceThis flexibility is useful for interactive scripts calling
2281dcc6ec7SPhilippe Charnier.Nm
229137db389SSteve Pricefor user and group database manipulation.
230d6f907dcSJoerg WunschFollowing these keywords, you may optionally specify the user or group name or numeric
231d6f907dcSJoerg Wunschid as an alternative to using the
232d6f907dcSJoerg Wunsch.Fl n Ar name ,
233d6f907dcSJoerg Wunsch.Fl u Ar uid ,
234d6f907dcSJoerg Wunsch.Fl g Ar gid
2359fd0dafcSJoerg Wunschoptions.
236d6f907dcSJoerg Wunsch.Pp
2375f12594aSDavid NugentThe following flags are common to most or all modes of operation;
238d6f907dcSJoerg Wunsch.Pp
2399fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist"
2405f12594aSDavid Nugent.It Fl V Ar etcdir
2415f12594aSDavid NugentThis flag sets an alternate location for the password, group and configuration files,
2425f12594aSDavid Nugentand may be used to maintain a user/group database in an alternate location.
2435f12594aSDavid NugentIf this switch is specified, the system
2445f12594aSDavid Nugent.Pa /etc/pw.conf
2455f12594aSDavid Nugentwill not be sourced for default configuration data, but the file pw.conf in the
2465f12594aSDavid Nugentspecified directory will be used instead (or none, if it does not exist).
2475f12594aSDavid NugentThe
2485f12594aSDavid Nugent.Fl C
2495f12594aSDavid Nugentflag may be used to override this behaviour.
2505f12594aSDavid NugentAs an exception to the general rule where options must follow the operation
2515f12594aSDavid Nugenttype, the
2525f12594aSDavid Nugent.Fl V
2535f12594aSDavid Nugentflag may be used on the command line before the operation keyword.
254d6f907dcSJoerg Wunsch.It Fl C Ar config
255d6f907dcSJoerg WunschBy default,
2561dcc6ec7SPhilippe Charnier.Nm
257d6f907dcSJoerg Wunschreads the file
258d6f907dcSJoerg Wunsch.Pa /etc/pw.conf
259137db389SSteve Priceto obtain policy information on how new user accounts and groups are to be created.
260137db389SSteve PriceThe
2619fd0dafcSJoerg Wunsch.Fl C
2629fd0dafcSJoerg Wunschoption specifies a different configuration file.
263137db389SSteve PriceWhile most of the contents of the configuration file may be overridden via
264137db389SSteve Pricecommand-line options, it may be more convenient to keep standard information in a
265137db389SSteve Priceconfiguration file.
266d6f907dcSJoerg Wunsch.It Fl q
267d6f907dcSJoerg WunschUse of this option causes
2681dcc6ec7SPhilippe Charnier.Nm
269d6f907dcSJoerg Wunschto suppress error messages, which may be useful in interactive environments where it
270d6f907dcSJoerg Wunschis preferable to interpret status codes returned by
2711dcc6ec7SPhilippe Charnier.Nm
272d6f907dcSJoerg Wunschrather than messing up a carefully formatted display.
2739fd0dafcSJoerg Wunsch.It Fl N
274137db389SSteve PriceThis option is available in
275137db389SSteve Price.Ar add
276137db389SSteve Priceand
277137db389SSteve Price.Ar modify
278137db389SSteve Priceoperations, and tells
2791dcc6ec7SPhilippe Charnier.Nm
280137db389SSteve Priceto output the result of the operation without updating the user or group
281137db389SSteve Pricedatabases.
2829fd0dafcSJoerg WunschYou may use the
2839fd0dafcSJoerg Wunsch.Fl P
2849fd0dafcSJoerg Wunschoption to switch between standard passwd and readable formats.
285f1d684faSDavid Nugent.It Fl Y
286f1d684faSDavid NugentUsing this option with any of the update modes causes
2871dcc6ec7SPhilippe Charnier.Nm
288f1d684faSDavid Nugentto run
289f1d684faSDavid Nugent.Xr make 1
290f1d684faSDavid Nugentafter changing to the directory
291f1d684faSDavid Nugent.Pa /var/yp .
292137db389SSteve PriceThis is intended to allow automatic updating of NIS database files.
293f1d684faSDavid NugentIf separate passwd and group files are being used by NIS, then use the
294f1d684faSDavid Nugent.Fl y Ar path
295137db389SSteve Priceoption to specify the location of the NIS passwd database so that
296137db389SSteve Price.Nm
297137db389SSteve Pricewill concurrently update it with the system password
298f1d684faSDavid Nugentdatabases.
299d6f907dcSJoerg Wunsch.El
300d6f907dcSJoerg Wunsch.Sh USER OPTIONS
301d6f907dcSJoerg WunschThe following options apply to the
302137db389SSteve Price.Ar useradd
303d6f907dcSJoerg Wunschand
304137db389SSteve Price.Ar usermod
305d6f907dcSJoerg Wunschcommands:
306d6f907dcSJoerg Wunsch.Pp
3079fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist"
308d6f907dcSJoerg Wunsch.It Fl n Ar name
3091dcc6ec7SPhilippe CharnierSpecify the user/account name.
310d6f907dcSJoerg Wunsch.It Fl u Ar uid
3111dcc6ec7SPhilippe CharnierSpecify the user/account numeric id.
312d6f907dcSJoerg Wunsch.Pp
313137db389SSteve PriceUsually, you only need to provide one or the other of these options, as the account
314137db389SSteve Pricename will imply the uid, or vice versa.
315137db389SSteve PriceHowever, there are times when you need to provide both.
316d6f907dcSJoerg WunschFor example, when changing the uid of an existing user with
317d6f907dcSJoerg Wunsch.Ar usermod ,
318d6f907dcSJoerg Wunschor overriding the default uid when creating a new account.
319d6f907dcSJoerg WunschIf you wish
3201dcc6ec7SPhilippe Charnier.Nm
321137db389SSteve Priceto automatically allocate the uid to a new user with
322d6f907dcSJoerg Wunsch.Ar useradd ,
323d6f907dcSJoerg Wunschthen you should
324d6f907dcSJoerg Wunsch.Em not
325d6f907dcSJoerg Wunschuse the
32608657612SRuslan Ermilov.Fl u
3279fd0dafcSJoerg Wunschoption.
328137db389SSteve PriceYou may also provide either the account or userid immediately after the
329137db389SSteve Price.Ar useradd ,
330137db389SSteve Price.Ar userdel ,
331137db389SSteve Price.Ar usermod
332137db389SSteve Priceor
333137db389SSteve Price.Ar usershow
334137db389SSteve Pricekeywords on the command line without using the
33508657612SRuslan Ermilov.Fl n
336137db389SSteve Priceor
33708657612SRuslan Ermilov.Fl u
338137db389SSteve Priceoptions.
339d6f907dcSJoerg Wunsch.El
340d6f907dcSJoerg Wunsch.Pp
341d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist"
342d6f907dcSJoerg Wunsch.It Fl c Ar comment
343d6f907dcSJoerg WunschThis field sets the contents of the passwd GECOS field, which normally contains up
344d6f907dcSJoerg Wunschto four comma-separated fields containing the user's full name, office or location,
345137db389SSteve Priceand work and home phone numbers.
346d6f907dcSJoerg WunschThese sub-fields are used by convention only, however, and are optional.
347d6f907dcSJoerg WunschIf this field is to contain spaces, you need to quote the comment itself with double
348d6f907dcSJoerg Wunschquotes
349d6f907dcSJoerg Wunsch.Ql \&" .
350d6f907dcSJoerg WunschAvoid using commas in this field as these are used as sub-field separators, and the
351d6f907dcSJoerg Wunschcolon
352d6f907dcSJoerg Wunsch.Ql \&:
353137db389SSteve Pricecharacter also cannot be used as this is the field separator for the passwd
354137db389SSteve Pricefile itself.
355d6f907dcSJoerg Wunsch.It Fl d Ar dir
356d6f907dcSJoerg WunschThis option sets the account's home directory.
357d6f907dcSJoerg WunschNormally, you will only use this if the home directory is to be different from the
358137db389SSteve Pricedefault determined from
359137db389SSteve Price.Pa /etc/pw.conf
3601dcc6ec7SPhilippe Charnier- normally
3611dcc6ec7SPhilippe Charnier.Pa /home
362137db389SSteve Pricewith the account name as a subdirectory.
363d6f907dcSJoerg Wunsch.It Fl e Ar date
3641dcc6ec7SPhilippe CharnierSet the account's expiration date.
365d6f907dcSJoerg WunschFormat of the date is either a UNIX time in decimal, or a date in
366137db389SSteve Price.Ql dd-mmm-yy[yy]
367d6f907dcSJoerg Wunschformat, where dd is the day, mmm is the month, either in numeric or alphabetic format
3681dcc6ec7SPhilippe Charnier('Jan', 'Feb', etc) and year is either a two or four digit year.
369d6f907dcSJoerg WunschThis option also accepts a relative date in the form
370d6f907dcSJoerg Wunsch.Ql \&+n[mhdwoy]
371d6f907dcSJoerg Wunschwhere
372d6f907dcSJoerg Wunsch.Ql \&n
373d6f907dcSJoerg Wunschis a decimal, octal (leading 0) or hexadecimal (leading 0x) digit followed by the
374053375e8SMike Pritchardnumber of Minutes, Hours, Days, Weeks, Months or Years from the current date at
375137db389SSteve Pricewhich the expiration date is to be set.
376d6f907dcSJoerg Wunsch.It Fl p Ar date
3771dcc6ec7SPhilippe CharnierSet the account's password expiration date.
378137db389SSteve PriceThis field is similar to the account expiration date option, except that it
379d6f907dcSJoerg Wunschapplies to forced password changes.
380137db389SSteve PriceThis is set in the same manner as the
38108657612SRuslan Ermilov.Fl e
382137db389SSteve Priceoption.
383d6f907dcSJoerg Wunsch.It Fl g Ar group
3841dcc6ec7SPhilippe CharnierSet the account's primary group to the given group.
385d6f907dcSJoerg Wunsch.Ar group
386137db389SSteve Pricemay be defined by either its name or group number.
387d6f907dcSJoerg Wunsch.It Fl G Ar grouplist
388137db389SSteve PriceSets additional group memberships for an account.
389d6f907dcSJoerg Wunsch.Ar grouplist
390137db389SSteve Priceis a comma-separated list of group names or group numbers.
391137db389SSteve PriceThe user's name is added to the group lists in
392d6f907dcSJoerg Wunsch.Pa /etc/group ,
393137db389SSteve Priceand
394d6f907dcSJoerg Wunschremoved from any groups not specified in
395d6f907dcSJoerg Wunsch.Ar grouplist .
396137db389SSteve PriceNote: a user should not be added to their primary group with
397137db389SSteve Price.Ar grouplist .
398137db389SSteve PriceAlso, group membership changes do not take effect for current user login
399137db389SSteve Pricesessions, requiring the user to reconnect to be affected by the changes.
4009fd0dafcSJoerg Wunsch.It Fl L Ar class
4019fd0dafcSJoerg WunschThis option sets the login class for the user being created.
4029fd0dafcSJoerg WunschSee
4039fd0dafcSJoerg Wunsch.Xr login.conf 5
40416b4ad52SGiorgos Keramidasand
40516b4ad52SGiorgos Keramidas.Xr passwd 5
406137db389SSteve Pricefor more information on user login classes.
407d6f907dcSJoerg Wunsch.It Fl m
408d6f907dcSJoerg WunschThis option instructs
4091dcc6ec7SPhilippe Charnier.Nm
410d6f907dcSJoerg Wunschto attempt to create the user's home directory.
411d6f907dcSJoerg WunschWhile primarily useful when adding a new account with
412d6f907dcSJoerg Wunsch.Ar useradd ,
413d6f907dcSJoerg Wunschthis may also be of use when moving an existing user's home directory elsewhere on
414d6f907dcSJoerg Wunschthe filesystem.
415d6f907dcSJoerg WunschThe new home directory is populated with the contents of the
416d6f907dcSJoerg Wunsch.Ar skeleton
417d6f907dcSJoerg Wunschdirectory, which typically contains a set of shell configuration files that the
418053375e8SMike Pritcharduser may personalize to taste.
419d6f907dcSJoerg WunschWhen
42008657612SRuslan Ermilov.Fl m
421d6f907dcSJoerg Wunschis used on an account with
422d6f907dcSJoerg Wunsch.Ar usermod ,
423137db389SSteve Priceexisting configuration files in the user's home directory are
424d6f907dcSJoerg Wunsch.Em not
425137db389SSteve Priceoverwritten from the skeleton files.
426d6f907dcSJoerg Wunsch.Pp
427137db389SSteve PriceWhen a user's home directory is created, it will by default be a subdirectory of the
428d6f907dcSJoerg Wunsch.Ar basehome
429137db389SSteve Pricedirectory as specified by the
43008657612SRuslan Ermilov.Fl b
431137db389SSteve Priceoption (see below), bearing the name of the new account.
432137db389SSteve PriceThis can be overridden by the
43308657612SRuslan Ermilov.Fl d
434d6f907dcSJoerg Wunschoption on the command line, if desired.
435d6f907dcSJoerg Wunsch.It Fl k Ar dir
4361dcc6ec7SPhilippe CharnierSet the
437d6f907dcSJoerg Wunsch.Ar skeleton
438137db389SSteve Pricedirectory, from which basic startup and configuration files are copied when
439d6f907dcSJoerg Wunschthe user's home directory is created.
440137db389SSteve PriceThis option only has meaning when used with the
44108657612SRuslan Ermilov.Fl d
442137db389SSteve Priceor
44308657612SRuslan Ermilov.Fl m
444137db389SSteve Priceflags.
445d6f907dcSJoerg Wunsch.It Fl s Ar shell
4461dcc6ec7SPhilippe CharnierSet or changes the user's login shell to
447d6f907dcSJoerg Wunsch.Ar shell .
448d6f907dcSJoerg WunschIf the path to the shell program is omitted,
4491dcc6ec7SPhilippe Charnier.Nm
450d6f907dcSJoerg Wunschsearches the
451d6f907dcSJoerg Wunsch.Ar shellpath
452d6f907dcSJoerg Wunschspecified in
453d6f907dcSJoerg Wunsch.Pa /etc/pw.conf
454d6f907dcSJoerg Wunschand fills it in as appropriate.
455d6f907dcSJoerg WunschNote that unless you have a specific reason to do so, you should avoid
456d6f907dcSJoerg Wunschspecifying the path - this will allow
4571dcc6ec7SPhilippe Charnier.Nm
458d6f907dcSJoerg Wunschto validate that the program exists and is executable.
459d6f907dcSJoerg WunschSpecifying a full path (or supplying a blank "" shell) avoids this check
460d6f907dcSJoerg Wunschand allows for such entries as
4611dcc6ec7SPhilippe Charnier.Pa /nonexistent
462d6f907dcSJoerg Wunschthat should be set for accounts not intended for interactive login.
463d6f907dcSJoerg Wunsch.It Fl h Ar fd
464d6f907dcSJoerg WunschThis option provides a special interface by which interactive scripts can
465d6f907dcSJoerg Wunschset an account password using
466e97407b4SRuslan Ermilov.Nm .
467137db389SSteve PriceBecause the command line and environment are fundamentally insecure mechanisms
468d6f907dcSJoerg Wunschby which programs can accept information,
4691dcc6ec7SPhilippe Charnier.Nm
470d6f907dcSJoerg Wunschwill only allow setting of account and group passwords via a file descriptor
471d6f907dcSJoerg Wunsch(usually a pipe between an interactive script and the program).
472d6f907dcSJoerg Wunsch.Ar sh ,
473d6f907dcSJoerg Wunsch.Ar bash ,
474d6f907dcSJoerg Wunsch.Ar ksh
475d6f907dcSJoerg Wunschand
476d6f907dcSJoerg Wunsch.Ar perl
477137db389SSteve Priceall possess mechanisms by which this can be done.
478d6f907dcSJoerg WunschAlternatively,
479325970a9SPhilippe Charnier.Nm
480d6f907dcSJoerg Wunschwill prompt for the user's password if
48108657612SRuslan Ermilov.Fl h Ar 0
482d6f907dcSJoerg Wunschis given, nominating
483d6f907dcSJoerg Wunsch.Em stdin
484d6f907dcSJoerg Wunschas the file descriptor on which to read the password.
485137db389SSteve PriceNote that this password will be read only once and is intended
486137db389SSteve Pricefor use by a script rather than for interactive use.
487d6f907dcSJoerg WunschIf you wish to have new password confirmation along the lines of
488d6f907dcSJoerg Wunsch.Xr passwd 1 ,
489137db389SSteve Pricethis must be implemented as part of an interactive script that calls
490e97407b4SRuslan Ermilov.Nm .
491d6f907dcSJoerg Wunsch.Pp
492d6f907dcSJoerg WunschIf a value of
493d6f907dcSJoerg Wunsch.Ql \&-
494d6f907dcSJoerg Wunschis given as the argument
495d6f907dcSJoerg Wunsch.Ar fd ,
496d6f907dcSJoerg Wunschthen the password will be set to
497d6f907dcSJoerg Wunsch.Ql \&* ,
498137db389SSteve Pricerendering the account inaccessible via password-based login.
499d6f907dcSJoerg Wunsch.El
500d6f907dcSJoerg Wunsch.Pp
501d6f907dcSJoerg WunschIt is possible to use
502d6f907dcSJoerg Wunsch.Ar useradd
503d6f907dcSJoerg Wunschto create a new account that duplicates an existing user id.
504d6f907dcSJoerg WunschWhile this is normally considered an error and will be rejected, the
50508657612SRuslan Ermilov.Fl o
5069fd0dafcSJoerg Wunschoption overrides the check for duplicates and allows the duplication of
5079fd0dafcSJoerg Wunschthe user id.
5089fd0dafcSJoerg WunschThis may be useful if you allow the same user to login under
5099fd0dafcSJoerg Wunschdifferent contexts (different group allocations, different home
5109fd0dafcSJoerg Wunschdirectory, different shell) while providing basically the same
5119fd0dafcSJoerg Wunschpermissions for access to the user's files in each account.
512d6f907dcSJoerg Wunsch.Pp
513d6f907dcSJoerg WunschThe
514d6f907dcSJoerg Wunsch.Ar useradd
515d6f907dcSJoerg Wunschcommand also has the ability to set new user and group defaults by using the
51608657612SRuslan Ermilov.Fl D
5179fd0dafcSJoerg Wunschoption.
518d6f907dcSJoerg WunschInstead of adding a new user,
5191dcc6ec7SPhilippe Charnier.Nm
520d6f907dcSJoerg Wunschwrites a new set of defaults to its configuration file,
521d6f907dcSJoerg Wunsch.Pa /etc/pw.conf .
522d6f907dcSJoerg WunschWhen using the
52308657612SRuslan Ermilov.Fl D
5249fd0dafcSJoerg Wunschoption, you must not use either
52508657612SRuslan Ermilov.Fl n Ar name
526d6f907dcSJoerg Wunschor
52708657612SRuslan Ermilov.Fl u Ar uid
528d6f907dcSJoerg Wunschor an error will result.
529d6f907dcSJoerg WunschUse of
53008657612SRuslan Ermilov.Fl D
5319fd0dafcSJoerg Wunschchanges the meaning of several command line switches in the
532d6f907dcSJoerg Wunsch.Ar useradd
533d6f907dcSJoerg Wunschcommand.
534d6f907dcSJoerg WunschThese are:
535d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist"
536d6f907dcSJoerg Wunsch.It Fl D
537d6f907dcSJoerg WunschSet default values in
538d6f907dcSJoerg Wunsch.Pa /etc/pw.conf
539d6f907dcSJoerg Wunschconfiguration file, or a different named configuration file if the
54008657612SRuslan Ermilov.Fl C Ar config
5419fd0dafcSJoerg Wunschoption is used.
542d6f907dcSJoerg Wunsch.It Fl b Ar dir
5431dcc6ec7SPhilippe CharnierSet the root directory in which user home directories are created.
544d6f907dcSJoerg WunschThe default value for this is
5451dcc6ec7SPhilippe Charnier.Pa /home ,
546d6f907dcSJoerg Wunschbut it may be set elsewhere as desired.
547d6f907dcSJoerg Wunsch.It Fl e Ar days
5481dcc6ec7SPhilippe CharnierSet the default account expiration period in days.
549d6f907dcSJoerg WunschUnlike use without
55008657612SRuslan Ermilov.Fl D ,
551d6f907dcSJoerg Wunschthe argument must be numeric, which specifies the number of days after creation when
552d6f907dcSJoerg Wunschthe account is to expire.
553d6f907dcSJoerg WunschA value of 0 suppresses automatic calculation of the expiry date.
554d6f907dcSJoerg Wunsch.It Fl p Ar days
5551dcc6ec7SPhilippe CharnierSet the default password expiration period in days.
556d6f907dcSJoerg Wunsch.It Fl g Ar group
5571dcc6ec7SPhilippe CharnierSet the default group for new users.
558d6f907dcSJoerg WunschIf a blank group is specified using
55908657612SRuslan Ermilov.Fl g Ar \&"" ,
560137db389SSteve Pricethen new users will be allocated their own private primary group
561137db389SSteve Pricewith the same name as their login name.
562d6f907dcSJoerg WunschIf a group is supplied, either its name or uid may be given as an argument.
563d6f907dcSJoerg Wunsch.It Fl G Ar grouplist
564137db389SSteve PriceSet the default groups in which new users are granted membership.
565d6f907dcSJoerg WunschThis is a separate set of groups from the primary group, and you should avoid
566137db389SSteve Pricenominating the same group as both primary and extra groups.
567d6f907dcSJoerg WunschIn other words, these extra groups determine membership in groups
568d6f907dcSJoerg Wunsch.Em other than
569d6f907dcSJoerg Wunschthe primary group.
570d6f907dcSJoerg Wunsch.Ar grouplist
571137db389SSteve Priceis a comma-separated list of group names or ids, and are always
572d6f907dcSJoerg Wunschstored in
573d6f907dcSJoerg Wunsch.Pa /etc/pw.conf
574d6f907dcSJoerg Wunschby their symbolic names.
5759fd0dafcSJoerg Wunsch.It Fl L Ar class
5769fd0dafcSJoerg WunschThis option sets the default login class for new users.
577d6f907dcSJoerg Wunsch.It Fl k Ar dir
5781dcc6ec7SPhilippe CharnierSet the default
579d6f907dcSJoerg Wunsch.Em skeleton
580053375e8SMike Pritcharddirectory, from which prototype shell and other initialization files are copied when
5811dcc6ec7SPhilippe Charnier.Nm
582d6f907dcSJoerg Wunschcreates a user's home directory.
583610a5778SRuslan Ermilov.It Xo
584610a5778SRuslan Ermilov.Fl u Ar min , Ns Ar max ,
585610a5778SRuslan Ermilov.Fl i Ar min , Ns Ar max
586610a5778SRuslan Ermilov.Xc
5879fd0dafcSJoerg WunschThese options set the minimum and maximum user and group ids allocated for new accounts
588d6f907dcSJoerg Wunschand groups created by
589e97407b4SRuslan Ermilov.Nm .
590d6f907dcSJoerg WunschThe default values for each is 1000 minimum and 32000 maximum.
591d6f907dcSJoerg Wunsch.Ar min
592d6f907dcSJoerg Wunschand
593d6f907dcSJoerg Wunsch.Ar max
594d6f907dcSJoerg Wunschare both numbers, where max must be greater than min, and both must be between 0
595d6f907dcSJoerg Wunschand 32767.
596d6f907dcSJoerg WunschIn general, user and group ids less than 100 are reserved for use by the system,
597d6f907dcSJoerg Wunschand numbers greater than 32000 may also be reserved for special purposes (used by
598d6f907dcSJoerg Wunschsome system daemons).
599d6f907dcSJoerg Wunsch.It Fl w Ar method
600d6f907dcSJoerg WunschThe
60108657612SRuslan Ermilov.Fl w
6029fd0dafcSJoerg Wunschoption sets the default method used to set passwords for newly created user accounts.
603d6f907dcSJoerg Wunsch.Ar method
604d6f907dcSJoerg Wunschis one of:
605d6f907dcSJoerg Wunsch.Pp
606d6f907dcSJoerg Wunsch.Bl -tag -width random -offset indent -compact
607d6f907dcSJoerg Wunsch.It no
6081dcc6ec7SPhilippe Charnierdisable login on newly created accounts
609d6f907dcSJoerg Wunsch.It yes
6101dcc6ec7SPhilippe Charnierforce the password to be the account name
611d6f907dcSJoerg Wunsch.It none
6121dcc6ec7SPhilippe Charnierforce a blank password
613d6f907dcSJoerg Wunsch.It random
6141dcc6ec7SPhilippe Charniergenerate a random password
615d6f907dcSJoerg Wunsch.El
616d6f907dcSJoerg Wunsch.Pp
617d6f907dcSJoerg WunschThe
618d6f907dcSJoerg Wunsch.Ql \&random
619d6f907dcSJoerg Wunschor
620d6f907dcSJoerg Wunsch.Ql \&no
621d6f907dcSJoerg Wunschmethods are the most secure; in the former case,
6221dcc6ec7SPhilippe Charnier.Nm
623d6f907dcSJoerg Wunschgenerates a password and prints it to stdout, which is suitable where you issue
624d6f907dcSJoerg Wunschusers with passwords to access their accounts rather than having the user nominate
625d6f907dcSJoerg Wunschtheir own (possibly poorly chosen) password.
626d6f907dcSJoerg WunschThe
627d6f907dcSJoerg Wunsch.Ql \&no
628d6f907dcSJoerg Wunschmethod requires that the superuser use
629d6f907dcSJoerg Wunsch.Xr passwd 1
630d6f907dcSJoerg Wunschto render the account accessible with a password.
631f1d684faSDavid Nugent.It Fl y Ar path
632f1d684faSDavid NugentThis sets the pathname of the database used by NIS if you are not sharing
633f1d684faSDavid Nugentthe information from
634f1d684faSDavid Nugent.Pa /etc/master.passwd
635f1d684faSDavid Nugentdirectly with NIS.
636137db389SSteve PriceYou should only set this option for NIS servers.
637d6f907dcSJoerg Wunsch.El
638d6f907dcSJoerg Wunsch.Pp
639d6f907dcSJoerg WunschThe
640d6f907dcSJoerg Wunsch.Ar userdel
641f2e366a1SSheldon Hearncommand has only three valid options.
642f2e366a1SSheldon HearnThe
64308657612SRuslan Ermilov.Fl n Ar name
644d6f907dcSJoerg Wunschand
64508657612SRuslan Ermilov.Fl u Ar uid
6469fd0dafcSJoerg Wunschoptions have already been covered above.
6479fd0dafcSJoerg WunschThe additional option is:
6489fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist"
649d6f907dcSJoerg Wunsch.It Fl r
650d6f907dcSJoerg WunschThis tells
6511dcc6ec7SPhilippe Charnier.Nm
652d6f907dcSJoerg Wunschto remove the user's home directory and all of its contents.
6531dcc6ec7SPhilippe Charnier.Nm Pw
654d6f907dcSJoerg Wunscherrs on the side of caution when removing files from the system.
655d6f907dcSJoerg WunschFirstly, it will not do so if the uid of the account being removed is also used by
656d6f907dcSJoerg Wunschanother account on the system, and the 'home' directory in the password file is
657d6f907dcSJoerg Wunscha valid path that commences with the character
658d6f907dcSJoerg Wunsch.Ql \&/ .
659d6f907dcSJoerg WunschSecondly, it will only remove files and directories that are actually owned by
660d6f907dcSJoerg Wunschthe user, or symbolic links owned by anyone under the user's home directory.
661d6f907dcSJoerg WunschFinally, after deleting all contents owned by the user only empty directories
662d6f907dcSJoerg Wunschwill be removed.
663053375e8SMike PritchardIf any additional cleanup work is required, this is left to the administrator.
664d6f907dcSJoerg Wunsch.El
665d6f907dcSJoerg Wunsch.Pp
666d6f907dcSJoerg WunschMail spool files and crontabs are always removed when an account is deleted as these
667d6f907dcSJoerg Wunschare unconditionally attached to the user name.
668d6f907dcSJoerg WunschJobs queued for processing by
669d6f907dcSJoerg Wunsch.Ar at
670137db389SSteve Priceare also removed if the user's uid is unique and not also used by another account on the
671137db389SSteve Pricesystem.
672d6f907dcSJoerg Wunsch.Pp
673d6f907dcSJoerg WunschThe
674d6f907dcSJoerg Wunsch.Ar usershow
675d6f907dcSJoerg Wunschcommand allows viewing of an account in one of two formats.
676d6f907dcSJoerg WunschBy default, the format is identical to the format used in
677d6f907dcSJoerg Wunsch.Pa /etc/master.passwd
678d6f907dcSJoerg Wunschwith the password field replaced with a
679d6f907dcSJoerg Wunsch.Ql \&* .
680d6f907dcSJoerg WunschIf the
68108657612SRuslan Ermilov.Fl P
6829fd0dafcSJoerg Wunschoption is used, then
6831dcc6ec7SPhilippe Charnier.Nm
684d6f907dcSJoerg Wunschoutputs the account details in a more human readable form.
6854731d076SDima DorfmanIf the
6864731d076SDima Dorfman.Fl 7
6874731d076SDima Dorfmanoption is used, the account details are shown in v7 format.
688d6f907dcSJoerg WunschThe
68908657612SRuslan Ermilov.Fl a
6909fd0dafcSJoerg Wunschoption lists all users currently on file.
6919fd0dafcSJoerg Wunsch.Pp
6929fd0dafcSJoerg WunschThe command
6939fd0dafcSJoerg Wunsch.Ar usernext
6949fd0dafcSJoerg Wunschreturns the next available user and group ids separated by a colon.
6959fd0dafcSJoerg WunschThis is normally of interest only to interactive scripts or front-ends
6969fd0dafcSJoerg Wunschthat use
697e97407b4SRuslan Ermilov.Nm .
698d6f907dcSJoerg Wunsch.Sh GROUP OPTIONS
699d6f907dcSJoerg WunschThe
70008657612SRuslan Ermilov.Fl C
701d6f907dcSJoerg Wunschand
70208657612SRuslan Ermilov.Fl q
7039fd0dafcSJoerg Wunschoptions (explained at the start of the previous section) are available
7049fd0dafcSJoerg Wunschwith the group manipulation commands.
705d6f907dcSJoerg WunschOther common options to all group-related commands are:
7069fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers"
707d6f907dcSJoerg Wunsch.It Fl n Ar name
7081dcc6ec7SPhilippe CharnierSpecify the group name.
709d6f907dcSJoerg Wunsch.It Fl g Ar gid
7101dcc6ec7SPhilippe CharnierSpecify the group numeric id.
711d6f907dcSJoerg Wunsch.Pp
7129fd0dafcSJoerg WunschAs with the account name and id fields, you will usually only need
7139fd0dafcSJoerg Wunschto supply one of these, as the group name implies the uid and vice
7149fd0dafcSJoerg Wunschversa.
7159fd0dafcSJoerg WunschYou will only need to use both when setting a specific group id
7169fd0dafcSJoerg Wunschagainst a new group or when changing the uid of an existing group.
7177ecd7a42SJoseph Koshy.It Fl M Ar memberlist
7189fd0dafcSJoerg WunschThis option provides an alternative way to add existing users to a
7199fd0dafcSJoerg Wunschnew group (in groupadd) or replace an existing membership list (in
7209fd0dafcSJoerg Wunschgroupmod).
7219fd0dafcSJoerg Wunsch.Ar memberlist
7229fd0dafcSJoerg Wunschis a comma separated list of valid and existing user names or uids.
7239fd0dafcSJoerg Wunsch.It Fl m Ar newmembers
7249fd0dafcSJoerg WunschSimilar to
72508657612SRuslan Ermilov.Fl M ,
7269fd0dafcSJoerg Wunschthis option allows the
7279fd0dafcSJoerg Wunsch.Em addition
728137db389SSteve Priceof existing users to a group without replacing the existing list of
7299fd0dafcSJoerg Wunschmembers.
730137db389SSteve PriceLogin names or user ids may be used, and duplicate users are
731137db389SSteve Pricesilently eliminated.
732d6f907dcSJoerg Wunsch.El
733d6f907dcSJoerg Wunsch.Pp
734d6f907dcSJoerg Wunsch.Ar groupadd
735d6f907dcSJoerg Wunschalso has a
73608657612SRuslan Ermilov.Fl o
737137db389SSteve Priceoption that allows allocation of an existing group id to a new group.
738d6f907dcSJoerg WunschThe default action is to reject an attempt to add a group, and this option overrides
739d6f907dcSJoerg Wunschthe check for duplicate group ids.
740d6f907dcSJoerg WunschThere is rarely any need to duplicate a group id.
741d6f907dcSJoerg Wunsch.Pp
742d6f907dcSJoerg WunschThe
743d6f907dcSJoerg Wunsch.Ar groupmod
744137db389SSteve Pricecommand adds one additional option:
745d6f907dcSJoerg Wunsch.Pp
7469fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers"
747d6f907dcSJoerg Wunsch.It Fl l Ar name
748d6f907dcSJoerg WunschThis option allows changing of an existing group name to
749d6f907dcSJoerg Wunsch.Ql \&name .
750d6f907dcSJoerg WunschThe new name must not already exist, and any attempt to duplicate an existing group
751d6f907dcSJoerg Wunschname will be rejected.
752d6f907dcSJoerg Wunsch.El
753d6f907dcSJoerg Wunsch.Pp
754d6f907dcSJoerg WunschOptions for
755d6f907dcSJoerg Wunsch.Ar groupshow
756d6f907dcSJoerg Wunschare the same as for
757d6f907dcSJoerg Wunsch.Ar usershow ,
758d6f907dcSJoerg Wunschwith the
75908657612SRuslan Ermilov.Fl g Ar gid
760d6f907dcSJoerg Wunschreplacing
76108657612SRuslan Ermilov.Fl u Ar uid
762d6f907dcSJoerg Wunschto specify the group id.
7634731d076SDima DorfmanThe
7644731d076SDima Dorfman.Fl 7
7654731d076SDima Dorfmanoption does not apply to the
7664731d076SDima Dorfman.Ar groupshow
7674731d076SDima Dorfmancommand.
768d6f907dcSJoerg Wunsch.Pp
7699fd0dafcSJoerg WunschThe command
7709fd0dafcSJoerg Wunsch.Ar groupnext
7719fd0dafcSJoerg Wunschreturns the next available group id on standard output.
772e468afb4SDima Dorfman.Sh USER LOCKING
773e468afb4SDima Dorfman.Nm Pw
774e468afb4SDima Dorfmansupports a simple password locking mechanism for users; it works by
775e468afb4SDima Dorfmanprepending the string
776e468afb4SDima Dorfman.Ql *LOCKED*
777e468afb4SDima Dorfmanto the beginning of the password field in
778e468afb4SDima Dorfman.Pa master.passwd
779e468afb4SDima Dorfmanto prevent successful authentication.
780e468afb4SDima Dorfman.Pp
781e468afb4SDima DorfmanThe
782e468afb4SDima Dorfman.Ar lock
783e468afb4SDima Dorfmanand
784e468afb4SDima Dorfman.Ar unlock
785e468afb4SDima Dorfmancommands take a user name or uid of the account to lock or unlock,
786e468afb4SDima Dorfmanrespectively.  The
78708657612SRuslan Ermilov.Fl V ,
78808657612SRuslan Ermilov.Fl C ,
789e468afb4SDima Dorfmanand
79008657612SRuslan Ermilov.Fl q
791e468afb4SDima Dorfmanoptions as described above are accepted by these commands.
7929fd0dafcSJoerg Wunsch.Sh DIAGNOSTICS
7931dcc6ec7SPhilippe Charnier.Nm Pw
794137db389SSteve Pricereturns EXIT_SUCCESS on successful operation, otherwise
795137db389SSteve Price.Nm
796137db389SSteve Pricereturns one of the
7979fd0dafcSJoerg Wunschfollowing exit codes defined by
7989fd0dafcSJoerg Wunsch.Xr sysexits 3
7999fd0dafcSJoerg Wunschas follows:
8009fd0dafcSJoerg Wunsch.Bl -tag -width xxxx
8019fd0dafcSJoerg Wunsch.It EX_USAGE
8029fd0dafcSJoerg Wunsch.Bl -bullet -compact
8039fd0dafcSJoerg Wunsch.It
8041dcc6ec7SPhilippe CharnierCommand line syntax errors (invalid keyword, unknown option).
8059fd0dafcSJoerg Wunsch.El
8069fd0dafcSJoerg Wunsch.It EX_NOPERM
8079fd0dafcSJoerg Wunsch.Bl -bullet -compact
8089fd0dafcSJoerg Wunsch.It
8099fd0dafcSJoerg WunschAttempting to run one of the update modes as non-root.
8109fd0dafcSJoerg Wunsch.El
8119fd0dafcSJoerg Wunsch.It EX_OSERR
8129fd0dafcSJoerg Wunsch.Bl -bullet -compact
8139fd0dafcSJoerg Wunsch.It
8149fd0dafcSJoerg WunschMemory allocation error.
8159fd0dafcSJoerg Wunsch.It
8169fd0dafcSJoerg WunschRead error from password file descriptor.
8179fd0dafcSJoerg Wunsch.El
8189fd0dafcSJoerg Wunsch.It EX_DATAERR
8199fd0dafcSJoerg Wunsch.Bl -bullet -compact
8209fd0dafcSJoerg Wunsch.It
8219fd0dafcSJoerg WunschBad or invalid data provided or missing on the command line or
822137db389SSteve Pricevia the password file descriptor.
8239fd0dafcSJoerg Wunsch.It
8249fd0dafcSJoerg WunschAttempted to remove, rename root account or change its uid.
8259fd0dafcSJoerg Wunsch.El
8269fd0dafcSJoerg Wunsch.It EX_OSFILE
8279fd0dafcSJoerg Wunsch.Bl -bullet -compact
8289fd0dafcSJoerg Wunsch.It
8299fd0dafcSJoerg WunschSkeleton directory is invalid or does not exist.
8309fd0dafcSJoerg Wunsch.It
8319fd0dafcSJoerg WunschBase home directory is invalid or does not exist.
8329fd0dafcSJoerg Wunsch.It
833137db389SSteve PriceInvalid or non-existent shell specified.
8349fd0dafcSJoerg Wunsch.El
8359fd0dafcSJoerg Wunsch.It EX_NOUSER
8369fd0dafcSJoerg Wunsch.Bl -bullet -compact
8379fd0dafcSJoerg Wunsch.It
8389fd0dafcSJoerg WunschUser, user id, group or group id specified does not exist.
8399fd0dafcSJoerg Wunsch.It
840137db389SSteve PriceUser or group recorded, added, or modified unexpectedly disappeared.
8419fd0dafcSJoerg Wunsch.El
8429fd0dafcSJoerg Wunsch.It EX_SOFTWARE
8439fd0dafcSJoerg Wunsch.Bl -bullet -compact
8449fd0dafcSJoerg Wunsch.It
8459fd0dafcSJoerg WunschNo more group or user ids available within specified range.
8469fd0dafcSJoerg Wunsch.El
8479fd0dafcSJoerg Wunsch.It EX_IOERR
8489fd0dafcSJoerg Wunsch.Bl -bullet -compact
8499fd0dafcSJoerg Wunsch.It
8509fd0dafcSJoerg WunschUnable to rewrite configuration file.
8519fd0dafcSJoerg Wunsch.It
8529fd0dafcSJoerg WunschError updating group or user database files.
8539fd0dafcSJoerg Wunsch.It
8549fd0dafcSJoerg WunschUpdate error for passwd or group database files.
8559fd0dafcSJoerg Wunsch.El
8569fd0dafcSJoerg Wunsch.It EX_CONFIG
8579fd0dafcSJoerg Wunsch.Bl -bullet -compact
8589fd0dafcSJoerg Wunsch.It
8599fd0dafcSJoerg WunschNo base home directory configured.
8609fd0dafcSJoerg Wunsch.El
8619fd0dafcSJoerg Wunsch.El
862d6f907dcSJoerg Wunsch.Sh NOTES
863d6f907dcSJoerg WunschFor a summary of options available with each command, you can use
864d6f907dcSJoerg Wunsch.Dl pw [command] help
865d6f907dcSJoerg WunschFor example,
866d6f907dcSJoerg Wunsch.Dl pw useradd help
867d6f907dcSJoerg Wunschlists all available options for the useradd operation.
868d9b711b7SDavid Nugent.Pp
8691dcc6ec7SPhilippe Charnier.Nm Pw
870137db389SSteve Priceallows 8-bit characters in the passwd GECOS field (user's full name,
871d9b711b7SDavid Nugentoffice, work and home phone number subfields), but disallows them in
872d9b711b7SDavid Nugentuser login and group names.
873137db389SSteve PriceUse 8-bit characters with caution, as connection to the Internet will
874d9b711b7SDavid Nugentrequire that your mail transport program supports 8BITMIME, and will
875d9b711b7SDavid Nugentconvert headers containing 8-bit characters to 7-bit quoted-printable
876d9b711b7SDavid Nugentformat.
877d9b711b7SDavid Nugent.Xr sendmail 8
878d9b711b7SDavid Nugentdoes support this.
879137db389SSteve PriceUse of 8-bit characters in the GECOS field should be used in
880d9b711b7SDavid Nugentconjunction with the user's default locale and character set
881d9b711b7SDavid Nugentand should not be implemented without their use.
882d9b711b7SDavid NugentUsing 8-bit characters may also affect other
883137db389SSteve Priceprograms that transmit the contents of the GECOS field over the
884137db389SSteve PriceInternet, such as
885d9b711b7SDavid Nugent.Xr fingerd 8 ,
886137db389SSteve Priceand a small number of TCP/IP clients, such as IRC, where full names
887d9b711b7SDavid Nugentspecified in the passwd file may be used by default.
888d6f907dcSJoerg Wunsch.Sh FILES
889d6f907dcSJoerg Wunsch.Bl -tag -width /etc/master.passwd.new -compact
890d6f907dcSJoerg Wunsch.It Pa /etc/master.passwd
891d6f907dcSJoerg WunschThe user database
892d6f907dcSJoerg Wunsch.It Pa /etc/passwd
893d6f907dcSJoerg WunschA Version 7 format password file
8949fd0dafcSJoerg Wunsch.It Pa /etc/login.conf
8959fd0dafcSJoerg WunschThe user capabilities database
896d6f907dcSJoerg Wunsch.It Pa /etc/group
897d6f907dcSJoerg WunschThe group database
898d6f907dcSJoerg Wunsch.It Pa /etc/master.passwd.new
899d6f907dcSJoerg WunschTemporary copy of the master password file
900d6f907dcSJoerg Wunsch.It Pa /etc/passwd.new
901d6f907dcSJoerg WunschTemporary copy of the Version 7 password file
902d6f907dcSJoerg Wunsch.It Pa /etc/group.new
903d6f907dcSJoerg WunschTemporary copy of the group file
904d6f907dcSJoerg Wunsch.It Pa /etc/pw.conf
905d6f907dcSJoerg WunschPw default options file
906d6f907dcSJoerg Wunsch.El
907d6f907dcSJoerg Wunsch.Sh SEE ALSO
908d6f907dcSJoerg Wunsch.Xr chpass 1 ,
909053375e8SMike Pritchard.Xr passwd 1 ,
910d6f907dcSJoerg Wunsch.Xr group 5 ,
911bfd34a4aSWolfram Schneider.Xr login.conf 5 ,
912053375e8SMike Pritchard.Xr passwd 5 ,
913053375e8SMike Pritchard.Xr pw.conf 5 ,
914d6f907dcSJoerg Wunsch.Xr pwd_mkdb 8 ,
915053375e8SMike Pritchard.Xr vipw 8
916d6f907dcSJoerg Wunsch.Sh HISTORY
9171dcc6ec7SPhilippe Charnier.Nm Pw
9189fd0dafcSJoerg Wunschwas written to mimic many of the options used in the SYSV
919d6f907dcSJoerg Wunsch.Em shadow
9209fd0dafcSJoerg Wunschsupport suite, but is modified for passwd and group fields specific to
921053375e8SMike Pritchardthe
922053375e8SMike Pritchard.Bx 4.4
9239fd0dafcSJoerg Wunschoperating system, and combines all of the major elements
9249fd0dafcSJoerg Wunschinto a single command.
925