xref: /freebsd/usr.sbin/pw/pw.8 (revision f7c4bd95ba735bd6a5454b4953945a99cefbb80c)
1.\" Copyright (C) 1996
2.\" David L. Nugent.  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 DAVID L. NUGENT 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 DAVID L. NUGENT 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.\" $FreeBSD$
26.\"
27.Dd March 30, 2007
28.Dt PW 8
29.Os
30.Sh NAME
31.Nm pw
32.Nd create, remove, modify & display system users and groups
33.Sh SYNOPSIS
34.Nm
35.Op Fl V Ar etcdir
36.Ar useradd
37.Op name|uid
38.Op Fl C Ar config
39.Op Fl q
40.Op Fl n Ar name
41.Op Fl u Ar uid
42.Op Fl c Ar comment
43.Op Fl d Ar dir
44.Op Fl e Ar date
45.Op Fl p Ar date
46.Op Fl g Ar group
47.Op Fl G Ar grouplist
48.Op Fl m
49.Op Fl M Ar mode
50.Op Fl k Ar dir
51.Op Fl w Ar method
52.Op Fl s Ar shell
53.Op Fl o
54.Op Fl L Ar class
55.Op Fl h Ar fd | Fl H Ar fd
56.Op Fl N
57.Op Fl P
58.Op Fl Y
59.Nm
60.Op Fl V Ar etcdir
61.Ar useradd
62.Op name|uid
63.Fl D
64.Op Fl C Ar config
65.Op Fl q
66.Op Fl b Ar dir
67.Op Fl e Ar days
68.Op Fl p Ar days
69.Op Fl g Ar group
70.Op Fl G Ar grouplist
71.Op Fl k Ar dir
72.Op Fl M Ar mode
73.Op Fl u Ar min , Ns Ar max
74.Op Fl i Ar min , Ns Ar max
75.Op Fl w Ar method
76.Op Fl s Ar shell
77.Op Fl y Ar path
78.Nm
79.Op Fl V Ar etcdir
80.Ar userdel
81.Op name|uid
82.Op Fl n Ar name
83.Op Fl u Ar uid
84.Op Fl r
85.Op Fl Y
86.Nm
87.Op Fl V Ar etcdir
88.Ar usermod
89.Op name|uid
90.Op Fl C Ar config
91.Op Fl q
92.Op Fl n Ar name
93.Op Fl u Ar uid
94.Op Fl c Ar comment
95.Op Fl d Ar dir
96.Op Fl e Ar date
97.Op Fl p Ar date
98.Op Fl g Ar group
99.Op Fl G Ar grouplist
100.Op Fl l Ar name
101.Op Fl m
102.Op Fl M Ar mode
103.Op Fl k Ar dir
104.Op Fl w Ar method
105.Op Fl s Ar shell
106.Op Fl L Ar class
107.Op Fl h Ar fd | Fl H Ar fd
108.Op Fl N
109.Op Fl P
110.Op Fl Y
111.Nm
112.Op Fl V Ar etcdir
113.Ar usershow
114.Op name|uid
115.Op Fl n Ar name
116.Op Fl u Ar uid
117.Op Fl F
118.Op Fl P
119.Op Fl 7
120.Op Fl a
121.Nm
122.Op Fl V Ar etcdir
123.Ar usernext
124.Op Fl C Ar config
125.Op Fl q
126.Nm
127.Op Fl V Ar etcdir
128.Ar groupadd
129.Op group|gid
130.Op Fl C Ar config
131.Op Fl q
132.Op Fl n Ar group
133.Op Fl g Ar gid
134.Op Fl M Ar members
135.Op Fl o
136.Op Fl h Ar fd | Fl H Ar fd
137.Op Fl N
138.Op Fl P
139.Op Fl Y
140.Nm
141.Op Fl V Ar etcdir
142.Ar groupdel
143.Op group|gid
144.Op Fl n Ar name
145.Op Fl g Ar gid
146.Op Fl Y
147.Nm
148.Op Fl V Ar etcdir
149.Ar groupmod
150.Op group|gid
151.Op Fl C Ar config
152.Op Fl q
153.Op Fl n Ar name
154.Op Fl g Ar gid
155.Op Fl l Ar name
156.Op Fl M Ar members
157.Op Fl m Ar newmembers
158.Op Fl d Ar oldmembers
159.Op Fl h Ar fd | Fl H Ar fd
160.Op Fl N
161.Op Fl P
162.Op Fl Y
163.Nm
164.Op Fl V Ar etcdir
165.Ar groupshow
166.Op group|gid
167.Op Fl n Ar name
168.Op Fl g Ar gid
169.Op Fl F
170.Op Fl P
171.Op Fl a
172.Nm
173.Op Fl V Ar etcdir
174.Ar groupnext
175.Op Fl C Ar config
176.Op Fl q
177.Nm
178.Op Fl V Ar etcdir
179.Ar lock
180.Op name|uid
181.Op Fl C Ar config
182.Op Fl q
183.Nm
184.Op Fl V Ar etcdir
185.Ar unlock
186.Op name|uid
187.Op Fl C Ar config
188.Op Fl q
189.Sh DESCRIPTION
190The
191.Nm
192utility is a command-line based editor for the system
193.Ar user
194and
195.Ar group
196files, allowing the superuser an easy to use and standardized way of adding,
197modifying and removing users and groups.
198Note that
199.Nm
200only operates on the local user and group files.
201.Tn NIS
202users and groups must be
203maintained on the
204.Tn NIS
205server.
206The
207.Nm
208utility handles updating the
209.Pa passwd ,
210.Pa master.passwd ,
211.Pa group
212and the secure and insecure
213password database files, and must be run as root.
214.Pp
215The first one or two keywords provided to
216.Nm
217on the command line provide the context for the remainder of the arguments.
218The keywords
219.Ar user
220and
221.Ar group
222may be combined with
223.Ar add ,
224.Ar del ,
225.Ar mod ,
226.Ar show ,
227or
228.Ar next
229in any order.
230(For example,
231.Ar showuser ,
232.Ar usershow ,
233.Ar show user ,
234and
235.Ar user show
236all mean the same thing.)
237This flexibility is useful for interactive scripts calling
238.Nm
239for user and group database manipulation.
240Following these keywords, you may optionally specify the user or group name or numeric
241id as an alternative to using the
242.Fl n Ar name ,
243.Fl u Ar uid ,
244.Fl g Ar gid
245options.
246.Pp
247The following flags are common to most or all modes of operation:
248.Pp
249.Bl -tag -width "-G grouplist"
250.It Fl V Ar etcdir
251This flag sets an alternate location for the password, group and configuration files,
252and may be used to maintain a user/group database in an alternate location.
253If this switch is specified, the system
254.Pa /etc/pw.conf
255will not be sourced for default configuration data, but the file pw.conf in the
256specified directory will be used instead (or none, if it does not exist).
257The
258.Fl C
259flag may be used to override this behaviour.
260As an exception to the general rule where options must follow the operation
261type, the
262.Fl V
263flag may be used on the command line before the operation keyword.
264.It Fl C Ar config
265By default,
266.Nm
267reads the file
268.Pa /etc/pw.conf
269to obtain policy information on how new user accounts and groups are to be created.
270The
271.Fl C
272option specifies a different configuration file.
273While most of the contents of the configuration file may be overridden via
274command-line options, it may be more convenient to keep standard information in a
275configuration file.
276.It Fl q
277Use of this option causes
278.Nm
279to suppress error messages, which may be useful in interactive environments where it
280is preferable to interpret status codes returned by
281.Nm
282rather than messing up a carefully formatted display.
283.It Fl N
284This option is available in
285.Ar add
286and
287.Ar modify
288operations, and tells
289.Nm
290to output the result of the operation without updating the user or group
291databases.
292You may use the
293.Fl P
294option to switch between standard passwd and readable formats.
295.It Fl Y
296Using this option with any of the update modes causes
297.Nm
298to run
299.Xr make 1
300after changing to the directory
301.Pa /var/yp .
302This is intended to allow automatic updating of
303.Tn NIS
304database files.
305If separate passwd and group files are being used by
306.Tn NIS ,
307then use the
308.Fl y Ar path
309option to specify the location of the
310.Tn NIS
311passwd database so that
312.Nm
313will concurrently update it with the system password
314databases.
315.El
316.Sh USER OPTIONS
317The following options apply to the
318.Ar useradd
319and
320.Ar usermod
321commands:
322.Pp
323.Bl -tag -width "-G grouplist"
324.It Fl n Ar name
325Specify the user/account name.
326.It Fl u Ar uid
327Specify the user/account numeric id.
328.Pp
329Usually, you only need to provide one or the other of these options, as the account
330name will imply the uid, or vice versa.
331However, there are times when you need to provide both.
332For example, when changing the uid of an existing user with
333.Ar usermod ,
334or overriding the default uid when creating a new account.
335If you wish
336.Nm
337to automatically allocate the uid to a new user with
338.Ar useradd ,
339then you should
340.Em not
341use the
342.Fl u
343option.
344You may also provide either the account or userid immediately after the
345.Ar useradd ,
346.Ar userdel ,
347.Ar usermod
348or
349.Ar usershow
350keywords on the command line without using the
351.Fl n
352or
353.Fl u
354options.
355.El
356.Pp
357.Bl -tag -width "-G grouplist"
358.It Fl c Ar comment
359This field sets the contents of the passwd GECOS field, which normally contains up
360to four comma-separated fields containing the user's full name, office or location,
361and work and home phone numbers.
362These sub-fields are used by convention only, however, and are optional.
363If this field is to contain spaces, you need to quote the comment itself with double
364quotes
365.Ql \&" .
366Avoid using commas in this field as these are used as sub-field separators, and the
367colon
368.Ql \&:
369character also cannot be used as this is the field separator for the passwd
370file itself.
371.It Fl d Ar dir
372This option sets the account's home directory.
373Normally, you will only use this if the home directory is to be different from the
374default determined from
375.Pa /etc/pw.conf
376- normally
377.Pa /home
378with the account name as a subdirectory.
379.It Fl e Ar date
380Set the account's expiration date.
381Format of the date is either a UNIX time in decimal, or a date in
382.Ql dd-mmm-yy[yy]
383format, where dd is the day, mmm is the month, either in numeric or alphabetic format
384('Jan', 'Feb', etc) and year is either a two or four digit year.
385This option also accepts a relative date in the form
386.Ql \&+n[mhdwoy]
387where
388.Ql \&n
389is a decimal, octal (leading 0) or hexadecimal (leading 0x) digit followed by the
390number of Minutes, Hours, Days, Weeks, Months or Years from the current date at
391which the expiration date is to be set.
392.It Fl p Ar date
393Set the account's password expiration date.
394This field is similar to the account expiration date option, except that it
395applies to forced password changes.
396This is set in the same manner as the
397.Fl e
398option.
399.It Fl g Ar group
400Set the account's primary group to the given group.
401.Ar group
402may be defined by either its name or group number.
403.It Fl G Ar grouplist
404Set additional group memberships for an account.
405.Ar grouplist
406is a comma, space or tab-separated list of group names or group numbers.
407The user's name is added to the group lists in
408.Pa /etc/group ,
409and
410removed from any groups not specified in
411.Ar grouplist .
412Note: a user should not be added to their primary group with
413.Ar grouplist .
414Also, group membership changes do not take effect for current user login
415sessions, requiring the user to reconnect to be affected by the changes.
416.It Fl L Ar class
417This option sets the login class for the user being created.
418See
419.Xr login.conf 5
420and
421.Xr passwd 5
422for more information on user login classes.
423.It Fl m
424This option instructs
425.Nm
426to attempt to create the user's home directory.
427While primarily useful when adding a new account with
428.Ar useradd ,
429this may also be of use when moving an existing user's home directory elsewhere on
430the file system.
431The new home directory is populated with the contents of the
432.Ar skeleton
433directory, which typically contains a set of shell configuration files that the
434user may personalize to taste.
435Files in this directory are usually named
436.Pa dot . Ns Aq Ar config
437where the
438.Pa dot
439prefix will be stripped.
440When
441.Fl m
442is used on an account with
443.Ar usermod ,
444existing configuration files in the user's home directory are
445.Em not
446overwritten from the skeleton files.
447.Pp
448When a user's home directory is created, it will by default be a subdirectory of the
449.Ar basehome
450directory as specified by the
451.Fl b
452option (see below), bearing the name of the new account.
453This can be overridden by the
454.Fl d
455option on the command line, if desired.
456.It Fl M Ar mode
457Create the user's home directory with the specified
458.Ar mode ,
459modified by the current
460.Xr umask 2 .
461If omitted, it is derived from the parent process'
462.Xr umask 2 .
463This option is only useful in combination with the
464.Fl m
465flag.
466.It Fl k Ar dir
467Set the
468.Ar skeleton
469directory, from which basic startup and configuration files are copied when
470the user's home directory is created.
471This option only has meaning when used with the
472.Fl d
473or
474.Fl m
475flags.
476.It Fl s Ar shell
477Set or changes the user's login shell to
478.Ar shell .
479If the path to the shell program is omitted,
480.Nm
481searches the
482.Ar shellpath
483specified in
484.Pa /etc/pw.conf
485and fills it in as appropriate.
486Note that unless you have a specific reason to do so, you should avoid
487specifying the path - this will allow
488.Nm
489to validate that the program exists and is executable.
490Specifying a full path (or supplying a blank "" shell) avoids this check
491and allows for such entries as
492.Pa /nonexistent
493that should be set for accounts not intended for interactive login.
494.It Fl h Ar fd
495This option provides a special interface by which interactive scripts can
496set an account password using
497.Nm .
498Because the command line and environment are fundamentally insecure mechanisms
499by which programs can accept information,
500.Nm
501will only allow setting of account and group passwords via a file descriptor
502(usually a pipe between an interactive script and the program).
503.Ar sh ,
504.Ar bash ,
505.Ar ksh
506and
507.Ar perl
508all possess mechanisms by which this can be done.
509Alternatively,
510.Nm
511will prompt for the user's password if
512.Fl h Ar 0
513is given, nominating
514.Em stdin
515as the file descriptor on which to read the password.
516Note that this password will be read only once and is intended
517for use by a script rather than for interactive use.
518If you wish to have new password confirmation along the lines of
519.Xr passwd 1 ,
520this must be implemented as part of an interactive script that calls
521.Nm .
522.Pp
523If a value of
524.Ql \&-
525is given as the argument
526.Ar fd ,
527then the password will be set to
528.Ql \&* ,
529rendering the account inaccessible via password-based login.
530.It Fl H Ar fd
531Read an encrypted password string from the specified file descriptor.
532This is like
533.Fl h ,
534but the password should be supplied already encrypted in a form
535suitable for writing directly to the password database.
536.El
537.Pp
538It is possible to use
539.Ar useradd
540to create a new account that duplicates an existing user id.
541While this is normally considered an error and will be rejected, the
542.Fl o
543option overrides the check for duplicates and allows the duplication of
544the user id.
545This may be useful if you allow the same user to login under
546different contexts (different group allocations, different home
547directory, different shell) while providing basically the same
548permissions for access to the user's files in each account.
549.Pp
550The
551.Ar useradd
552command also has the ability to set new user and group defaults by using the
553.Fl D
554option.
555Instead of adding a new user,
556.Nm
557writes a new set of defaults to its configuration file,
558.Pa /etc/pw.conf .
559When using the
560.Fl D
561option, you must not use either
562.Fl n Ar name
563or
564.Fl u Ar uid
565or an error will result.
566Use of
567.Fl D
568changes the meaning of several command line switches in the
569.Ar useradd
570command.
571These are:
572.Bl -tag -width "-G grouplist"
573.It Fl D
574Set default values in
575.Pa /etc/pw.conf
576configuration file, or a different named configuration file if the
577.Fl C Ar config
578option is used.
579.It Fl b Ar dir
580Set the root directory in which user home directories are created.
581The default value for this is
582.Pa /home ,
583but it may be set elsewhere as desired.
584.It Fl e Ar days
585Set the default account expiration period in days.
586Unlike use without
587.Fl D ,
588the argument must be numeric, which specifies the number of days after creation when
589the account is to expire.
590A value of 0 suppresses automatic calculation of the expiry date.
591.It Fl p Ar days
592Set the default password expiration period in days.
593.It Fl g Ar group
594Set the default group for new users.
595If a blank group is specified using
596.Fl g Ar \&"" ,
597then new users will be allocated their own private primary group
598with the same name as their login name.
599If a group is supplied, either its name or uid may be given as an argument.
600.It Fl G Ar grouplist
601Set the default groups in which new users are granted membership.
602This is a separate set of groups from the primary group, and you should avoid
603nominating the same group as both primary and extra groups.
604In other words, these extra groups determine membership in groups
605.Em other than
606the primary group.
607.Ar grouplist
608is a comma-separated list of group names or ids, and are always
609stored in
610.Pa /etc/pw.conf
611by their symbolic names.
612.It Fl L Ar class
613This option sets the default login class for new users.
614.It Fl k Ar dir
615Set the default
616.Em skeleton
617directory, from which prototype shell and other initialization files are copied when
618.Nm
619creates a user's home directory.
620See description of
621.Fl k
622for naming conventions of these files.
623.It Xo
624.Fl u Ar min , Ns Ar max ,
625.Fl i Ar min , Ns Ar max
626.Xc
627These options set the minimum and maximum user and group ids allocated for new accounts
628and groups created by
629.Nm .
630The default values for each is 1000 minimum and 32000 maximum.
631.Ar min
632and
633.Ar max
634are both numbers, where max must be greater than min, and both must be between 0
635and 32767.
636In general, user and group ids less than 100 are reserved for use by the system,
637and numbers greater than 32000 may also be reserved for special purposes (used by
638some system daemons).
639.It Fl w Ar method
640The
641.Fl w
642option sets the default method used to set passwords for newly created user accounts.
643.Ar method
644is one of:
645.Pp
646.Bl -tag -width random -offset indent -compact
647.It no
648disable login on newly created accounts
649.It yes
650force the password to be the account name
651.It none
652force a blank password
653.It random
654generate a random password
655.El
656.Pp
657The
658.Ql \&random
659or
660.Ql \&no
661methods are the most secure; in the former case,
662.Nm
663generates a password and prints it to stdout, which is suitable where you issue
664users with passwords to access their accounts rather than having the user nominate
665their own (possibly poorly chosen) password.
666The
667.Ql \&no
668method requires that the superuser use
669.Xr passwd 1
670to render the account accessible with a password.
671.It Fl y Ar path
672This sets the pathname of the database used by
673.Tn NIS
674if you are not sharing
675the information from
676.Pa /etc/master.passwd
677directly with
678.Tn NIS .
679You should only set this option for
680.Tn NIS
681servers.
682.El
683.Pp
684The
685.Ar userdel
686command has only three valid options.
687The
688.Fl n Ar name
689and
690.Fl u Ar uid
691options have already been covered above.
692The additional option is:
693.Bl -tag -width "-G grouplist"
694.It Fl r
695This tells
696.Nm
697to remove the user's home directory and all of its contents.
698The
699.Nm
700utility errs on the side of caution when removing files from the system.
701Firstly, it will not do so if the uid of the account being removed is also used by
702another account on the system, and the 'home' directory in the password file is
703a valid path that commences with the character
704.Ql \&/ .
705Secondly, it will only remove files and directories that are actually owned by
706the user, or symbolic links owned by anyone under the user's home directory.
707Finally, after deleting all contents owned by the user only empty directories
708will be removed.
709If any additional cleanup work is required, this is left to the administrator.
710.El
711.Pp
712Mail spool files and crontabs are always removed when an account is deleted as these
713are unconditionally attached to the user name.
714Jobs queued for processing by
715.Ar at
716are also removed if the user's uid is unique and not also used by another account on the
717system.
718.Pp
719The
720.Ar usershow
721command allows viewing of an account in one of two formats.
722By default, the format is identical to the format used in
723.Pa /etc/master.passwd
724with the password field replaced with a
725.Ql \&* .
726If the
727.Fl P
728option is used, then
729.Nm
730outputs the account details in a more human readable form.
731If the
732.Fl 7
733option is used, the account details are shown in v7 format.
734The
735.Fl a
736option lists all users currently on file.
737Using
738.Fl F
739forces
740.Nm
741to print the details of an account even if it does not exist.
742.Pp
743The command
744.Ar usernext
745returns the next available user and group ids separated by a colon.
746This is normally of interest only to interactive scripts or front-ends
747that use
748.Nm .
749.Sh GROUP OPTIONS
750The
751.Fl C
752and
753.Fl q
754options (explained at the start of the previous section) are available
755with the group manipulation commands.
756Other common options to all group-related commands are:
757.Bl -tag -width "-m newmembers"
758.It Fl n Ar name
759Specify the group name.
760.It Fl g Ar gid
761Specify the group numeric id.
762.Pp
763As with the account name and id fields, you will usually only need
764to supply one of these, as the group name implies the uid and vice
765versa.
766You will only need to use both when setting a specific group id
767against a new group or when changing the uid of an existing group.
768.It Fl M Ar memberlist
769This option provides an alternative way to add existing users to a
770new group (in groupadd) or replace an existing membership list (in
771groupmod).
772.Ar memberlist
773is a comma separated list of valid and existing user names or uids.
774.It Fl m Ar newmembers
775Similar to
776.Fl M ,
777this option allows the
778.Em addition
779of existing users to a group without replacing the existing list of
780members.
781Login names or user ids may be used, and duplicate users are
782silently eliminated.
783.It Fl d Ar oldmembers
784Similar to
785.Fl M ,
786this option allows the
787.Em deletion
788of existing users from a group without replacing the existing list of
789members.
790Login names or user ids may be used, and duplicate users are
791silently eliminated.
792.El
793.Pp
794.Ar groupadd
795also has a
796.Fl o
797option that allows allocation of an existing group id to a new group.
798The default action is to reject an attempt to add a group, and this option overrides
799the check for duplicate group ids.
800There is rarely any need to duplicate a group id.
801.Pp
802The
803.Ar groupmod
804command adds one additional option:
805.Pp
806.Bl -tag -width "-m newmembers"
807.It Fl l Ar name
808This option allows changing of an existing group name to
809.Ql \&name .
810The new name must not already exist, and any attempt to duplicate an existing group
811name will be rejected.
812.El
813.Pp
814Options for
815.Ar groupshow
816are the same as for
817.Ar usershow ,
818with the
819.Fl g Ar gid
820replacing
821.Fl u Ar uid
822to specify the group id.
823The
824.Fl 7
825option does not apply to the
826.Ar groupshow
827command.
828.Pp
829The command
830.Ar groupnext
831returns the next available group id on standard output.
832.Sh USER LOCKING
833The
834.Nm
835utility
836supports a simple password locking mechanism for users; it works by
837prepending the string
838.Ql *LOCKED*
839to the beginning of the password field in
840.Pa master.passwd
841to prevent successful authentication.
842.Pp
843The
844.Ar lock
845and
846.Ar unlock
847commands take a user name or uid of the account to lock or unlock,
848respectively.
849The
850.Fl V ,
851.Fl C ,
852and
853.Fl q
854options as described above are accepted by these commands.
855.Sh NOTES
856For a summary of options available with each command, you can use
857.Dl pw [command] help
858For example,
859.Dl pw useradd help
860lists all available options for the useradd operation.
861.Pp
862The
863.Nm
864utility allows 8-bit characters in the passwd GECOS field (user's full name,
865office, work and home phone number subfields), but disallows them in
866user login and group names.
867Use 8-bit characters with caution, as connection to the Internet will
868require that your mail transport program supports 8BITMIME, and will
869convert headers containing 8-bit characters to 7-bit quoted-printable
870format.
871.Xr sendmail 8
872does support this.
873Use of 8-bit characters in the GECOS field should be used in
874conjunction with the user's default locale and character set
875and should not be implemented without their use.
876Using 8-bit characters may also affect other
877programs that transmit the contents of the GECOS field over the
878Internet, such as
879.Xr fingerd 8 ,
880and a small number of TCP/IP clients, such as IRC, where full names
881specified in the passwd file may be used by default.
882.Pp
883The
884.Nm
885utility writes a log to the
886.Pa /var/log/userlog
887file when actions such as user or group additions or deletions occur.
888The location of this logfile can be changed in
889.Xr pw.conf 5 .
890.Sh FILES
891.Bl -tag -width /etc/master.passwd.new -compact
892.It Pa /etc/master.passwd
893The user database
894.It Pa /etc/passwd
895A Version 7 format password file
896.It Pa /etc/login.conf
897The user capabilities database
898.It Pa /etc/group
899The group database
900.It Pa /etc/master.passwd.new
901Temporary copy of the master password file
902.It Pa /etc/passwd.new
903Temporary copy of the Version 7 password file
904.It Pa /etc/group.new
905Temporary copy of the group file
906.It Pa /etc/pw.conf
907Pw default options file
908.It Pa /var/log/userlog
909User/group modification logfile
910.El
911.Sh EXIT STATUS
912The
913.Nm
914utility returns EXIT_SUCCESS on successful operation, otherwise
915.Nm
916returns one of the
917following exit codes defined by
918.Xr sysexits 3
919as follows:
920.Bl -tag -width xxxx
921.It EX_USAGE
922.Bl -bullet -compact
923.It
924Command line syntax errors (invalid keyword, unknown option).
925.El
926.It EX_NOPERM
927.Bl -bullet -compact
928.It
929Attempting to run one of the update modes as non-root.
930.El
931.It EX_OSERR
932.Bl -bullet -compact
933.It
934Memory allocation error.
935.It
936Read error from password file descriptor.
937.El
938.It EX_DATAERR
939.Bl -bullet -compact
940.It
941Bad or invalid data provided or missing on the command line or
942via the password file descriptor.
943.It
944Attempted to remove, rename root account or change its uid.
945.El
946.It EX_OSFILE
947.Bl -bullet -compact
948.It
949Skeleton directory is invalid or does not exist.
950.It
951Base home directory is invalid or does not exist.
952.It
953Invalid or non-existent shell specified.
954.El
955.It EX_NOUSER
956.Bl -bullet -compact
957.It
958User, user id, group or group id specified does not exist.
959.It
960User or group recorded, added, or modified unexpectedly disappeared.
961.El
962.It EX_SOFTWARE
963.Bl -bullet -compact
964.It
965No more group or user ids available within specified range.
966.El
967.It EX_IOERR
968.Bl -bullet -compact
969.It
970Unable to rewrite configuration file.
971.It
972Error updating group or user database files.
973.It
974Update error for passwd or group database files.
975.El
976.It EX_CONFIG
977.Bl -bullet -compact
978.It
979No base home directory configured.
980.El
981.El
982.Sh SEE ALSO
983.Xr chpass 1 ,
984.Xr passwd 1 ,
985.Xr umask 2 ,
986.Xr group 5 ,
987.Xr login.conf 5 ,
988.Xr passwd 5 ,
989.Xr pw.conf 5 ,
990.Xr pwd_mkdb 8 ,
991.Xr vipw 8
992.Sh HISTORY
993The
994.Nm
995utility was written to mimic many of the options used in the SYSV
996.Em shadow
997support suite, but is modified for passwd and group fields specific to
998the
999.Bx 4.4
1000operating system, and combines all of the major elements
1001into a single command.
1002