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