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.\" 2785204142SLukas Ertl.Dd March 30, 2007 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 49eebbeceeSLukas Ertl.Op Fl M Ar mode 50d6f907dcSJoerg Wunsch.Op Fl k Ar dir 51f5875822SSADA Kenji.Op Fl w Ar method 52d6f907dcSJoerg Wunsch.Op Fl s Ar shell 53d6f907dcSJoerg Wunsch.Op Fl o 54d6f907dcSJoerg Wunsch.Op Fl L Ar class 5587d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 569fd0dafcSJoerg Wunsch.Op Fl N 579fd0dafcSJoerg Wunsch.Op Fl P 58f1d684faSDavid Nugent.Op Fl Y 59e97407b4SRuslan Ermilov.Nm 605f12594aSDavid Nugent.Op Fl V Ar etcdir 61d6f907dcSJoerg Wunsch.Ar useradd 62d6f907dcSJoerg Wunsch.Op name|uid 63f1d684faSDavid Nugent.Fl D 64d6f907dcSJoerg Wunsch.Op Fl C Ar config 65d6f907dcSJoerg Wunsch.Op Fl q 66d6f907dcSJoerg Wunsch.Op Fl b Ar dir 67d6f907dcSJoerg Wunsch.Op Fl e Ar days 68d6f907dcSJoerg Wunsch.Op Fl p Ar days 69d6f907dcSJoerg Wunsch.Op Fl g Ar group 70d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist 71d6f907dcSJoerg Wunsch.Op Fl k Ar dir 7285204142SLukas Ertl.Op Fl M Ar mode 73610a5778SRuslan Ermilov.Op Fl u Ar min , Ns Ar max 74610a5778SRuslan Ermilov.Op Fl i Ar min , Ns Ar max 75d6f907dcSJoerg Wunsch.Op Fl w Ar method 76d6f907dcSJoerg Wunsch.Op Fl s Ar shell 77f1d684faSDavid Nugent.Op Fl y Ar path 78e97407b4SRuslan Ermilov.Nm 795f12594aSDavid Nugent.Op Fl V Ar etcdir 80d6f907dcSJoerg Wunsch.Ar userdel 81d6f907dcSJoerg Wunsch.Op name|uid 82d6f907dcSJoerg Wunsch.Op Fl n Ar name 83d6f907dcSJoerg Wunsch.Op Fl u Ar uid 84d6f907dcSJoerg Wunsch.Op Fl r 85f1d684faSDavid Nugent.Op Fl Y 86e97407b4SRuslan Ermilov.Nm 875f12594aSDavid Nugent.Op Fl V Ar etcdir 88d6f907dcSJoerg Wunsch.Ar usermod 89d6f907dcSJoerg Wunsch.Op name|uid 90d6f907dcSJoerg Wunsch.Op Fl C Ar config 91d6f907dcSJoerg Wunsch.Op Fl q 92d6f907dcSJoerg Wunsch.Op Fl n Ar name 93d6f907dcSJoerg Wunsch.Op Fl u Ar uid 94d6f907dcSJoerg Wunsch.Op Fl c Ar comment 95d6f907dcSJoerg Wunsch.Op Fl d Ar dir 96d6f907dcSJoerg Wunsch.Op Fl e Ar date 97d6f907dcSJoerg Wunsch.Op Fl p Ar date 98d6f907dcSJoerg Wunsch.Op Fl g Ar group 99d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist 100d6f907dcSJoerg Wunsch.Op Fl l Ar name 101d6f907dcSJoerg Wunsch.Op Fl m 102eebbeceeSLukas Ertl.Op Fl M Ar mode 103d6f907dcSJoerg Wunsch.Op Fl k Ar dir 1049fd0dafcSJoerg Wunsch.Op Fl w Ar method 105d6f907dcSJoerg Wunsch.Op Fl s Ar shell 106d6f907dcSJoerg Wunsch.Op Fl L Ar class 10787d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1089fd0dafcSJoerg Wunsch.Op Fl N 1099fd0dafcSJoerg Wunsch.Op Fl P 110f1d684faSDavid Nugent.Op Fl Y 111e97407b4SRuslan Ermilov.Nm 1125f12594aSDavid Nugent.Op Fl V Ar etcdir 113d6f907dcSJoerg Wunsch.Ar usershow 114d6f907dcSJoerg Wunsch.Op name|uid 115d6f907dcSJoerg Wunsch.Op Fl n Ar name 116d6f907dcSJoerg Wunsch.Op Fl u Ar uid 117d6f907dcSJoerg Wunsch.Op Fl F 1189fd0dafcSJoerg Wunsch.Op Fl P 1194731d076SDima Dorfman.Op Fl 7 120d6f907dcSJoerg Wunsch.Op Fl a 121e97407b4SRuslan Ermilov.Nm 1225f12594aSDavid Nugent.Op Fl V Ar etcdir 1239fd0dafcSJoerg Wunsch.Ar usernext 1249fd0dafcSJoerg Wunsch.Op Fl C Ar config 1259fd0dafcSJoerg Wunsch.Op Fl q 126e97407b4SRuslan Ermilov.Nm 1275f12594aSDavid Nugent.Op Fl V Ar etcdir 128d6f907dcSJoerg Wunsch.Ar groupadd 129d6f907dcSJoerg Wunsch.Op group|gid 130d6f907dcSJoerg Wunsch.Op Fl C Ar config 131d6f907dcSJoerg Wunsch.Op Fl q 132d6f907dcSJoerg Wunsch.Op Fl n Ar group 133d6f907dcSJoerg Wunsch.Op Fl g Ar gid 1349fd0dafcSJoerg Wunsch.Op Fl M Ar members 135d6f907dcSJoerg Wunsch.Op Fl o 13687d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1379fd0dafcSJoerg Wunsch.Op Fl N 1389fd0dafcSJoerg Wunsch.Op Fl P 139f1d684faSDavid Nugent.Op Fl Y 140e97407b4SRuslan Ermilov.Nm 1415f12594aSDavid Nugent.Op Fl V Ar etcdir 142d6f907dcSJoerg Wunsch.Ar groupdel 14306f64964SJoseph Koshy.Op group|gid 144d6f907dcSJoerg Wunsch.Op Fl n Ar name 145d6f907dcSJoerg Wunsch.Op Fl g Ar gid 146f1d684faSDavid Nugent.Op Fl Y 147e97407b4SRuslan Ermilov.Nm 1485f12594aSDavid Nugent.Op Fl V Ar etcdir 149d6f907dcSJoerg Wunsch.Ar groupmod 15006f64964SJoseph Koshy.Op group|gid 151d6f907dcSJoerg Wunsch.Op Fl C Ar config 152d6f907dcSJoerg Wunsch.Op Fl q 153d6f907dcSJoerg Wunsch.Op Fl n Ar name 154d6f907dcSJoerg Wunsch.Op Fl g Ar gid 155d6f907dcSJoerg Wunsch.Op Fl l Ar name 1569fd0dafcSJoerg Wunsch.Op Fl M Ar members 1579fd0dafcSJoerg Wunsch.Op Fl m Ar newmembers 15887d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1599fd0dafcSJoerg Wunsch.Op Fl N 1609fd0dafcSJoerg Wunsch.Op Fl P 161f1d684faSDavid Nugent.Op Fl Y 162e97407b4SRuslan Ermilov.Nm 1635f12594aSDavid Nugent.Op Fl V Ar etcdir 164d6f907dcSJoerg Wunsch.Ar groupshow 16506f64964SJoseph Koshy.Op group|gid 166d6f907dcSJoerg Wunsch.Op Fl n Ar name 167d6f907dcSJoerg Wunsch.Op Fl g Ar gid 168d6f907dcSJoerg Wunsch.Op Fl F 1699fd0dafcSJoerg Wunsch.Op Fl P 170d6f907dcSJoerg Wunsch.Op Fl a 171e97407b4SRuslan Ermilov.Nm 1725f12594aSDavid Nugent.Op Fl V Ar etcdir 1739fd0dafcSJoerg Wunsch.Ar groupnext 1749fd0dafcSJoerg Wunsch.Op Fl C Ar config 1759fd0dafcSJoerg Wunsch.Op Fl q 176e468afb4SDima Dorfman.Nm 177e468afb4SDima Dorfman.Op Fl V Ar etcdir 178e468afb4SDima Dorfman.Ar lock 179e468afb4SDima Dorfman.Op name|uid 180e468afb4SDima Dorfman.Op Fl C Ar config 181e468afb4SDima Dorfman.Op Fl q 182e468afb4SDima Dorfman.Nm 183e468afb4SDima Dorfman.Op Fl V Ar etcdir 184e468afb4SDima Dorfman.Ar unlock 185e468afb4SDima Dorfman.Op name|uid 186e468afb4SDima Dorfman.Op Fl C Ar config 187e468afb4SDima Dorfman.Op Fl q 188d6f907dcSJoerg Wunsch.Sh DESCRIPTION 189490d5836SPhilippe CharnierThe 190490d5836SPhilippe Charnier.Nm 191490d5836SPhilippe Charnierutility is a command-line based editor for the system 1921dcc6ec7SPhilippe Charnier.Ar user 193d6f907dcSJoerg Wunschand 1941dcc6ec7SPhilippe Charnier.Ar group 1953a7e7077SDaniel O'Callaghanfiles, allowing the superuser an easy to use and standardized way of adding, 196d6f907dcSJoerg Wunschmodifying and removing users and groups. 197d6f907dcSJoerg WunschNote that 1981dcc6ec7SPhilippe Charnier.Nm 199490d5836SPhilippe Charnieronly operates on the local user and group files. 200490d5836SPhilippe Charnier.Tn NIS 201490d5836SPhilippe Charnierusers and groups must be 202490d5836SPhilippe Charniermaintained on the 203490d5836SPhilippe Charnier.Tn NIS 204490d5836SPhilippe Charnierserver. 205490d5836SPhilippe CharnierThe 206490d5836SPhilippe Charnier.Nm 207490d5836SPhilippe Charnierutility handles updating the 208053375e8SMike Pritchard.Pa passwd , 209053375e8SMike Pritchard.Pa master.passwd , 210053375e8SMike Pritchard.Pa group 211053375e8SMike Pritchardand the secure and insecure 212d6f907dcSJoerg Wunschpassword database files, and must be run as root. 213d6f907dcSJoerg Wunsch.Pp 214137db389SSteve PriceThe first one or two keywords provided to 215137db389SSteve Price.Nm 216137db389SSteve Priceon the command line provide the context for the remainder of the arguments. 217137db389SSteve PriceThe keywords 218d6f907dcSJoerg Wunsch.Ar user 219d6f907dcSJoerg Wunschand 220d6f907dcSJoerg Wunsch.Ar group 221137db389SSteve Pricemay be combined with 222d6f907dcSJoerg Wunsch.Ar add , 223d6f907dcSJoerg Wunsch.Ar del , 2249fd0dafcSJoerg Wunsch.Ar mod , 225d6f907dcSJoerg Wunsch.Ar show , 2269fd0dafcSJoerg Wunschor 227137db389SSteve Price.Ar next 2284e86fcacSSheldon Hearnin any order. 2294e86fcacSSheldon Hearn(For example, 230137db389SSteve Price.Ar showuser , 231137db389SSteve Price.Ar usershow , 232610a5778SRuslan Ermilov.Ar show user , 233610a5778SRuslan Ermilovand 234137db389SSteve Price.Ar user show 235137db389SSteve Priceall mean the same thing.) 236137db389SSteve PriceThis flexibility is useful for interactive scripts calling 2371dcc6ec7SPhilippe Charnier.Nm 238137db389SSteve Pricefor user and group database manipulation. 239d6f907dcSJoerg WunschFollowing these keywords, you may optionally specify the user or group name or numeric 240d6f907dcSJoerg Wunschid as an alternative to using the 241d6f907dcSJoerg Wunsch.Fl n Ar name , 242d6f907dcSJoerg Wunsch.Fl u Ar uid , 243d6f907dcSJoerg Wunsch.Fl g Ar gid 2449fd0dafcSJoerg Wunschoptions. 245d6f907dcSJoerg Wunsch.Pp 246d5a3b1edSDima DorfmanThe following flags are common to most or all modes of operation: 247d6f907dcSJoerg Wunsch.Pp 2489fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 2495f12594aSDavid Nugent.It Fl V Ar etcdir 2505f12594aSDavid NugentThis flag sets an alternate location for the password, group and configuration files, 2515f12594aSDavid Nugentand may be used to maintain a user/group database in an alternate location. 2525f12594aSDavid NugentIf this switch is specified, the system 2535f12594aSDavid Nugent.Pa /etc/pw.conf 2545f12594aSDavid Nugentwill not be sourced for default configuration data, but the file pw.conf in the 2555f12594aSDavid Nugentspecified directory will be used instead (or none, if it does not exist). 2565f12594aSDavid NugentThe 2575f12594aSDavid Nugent.Fl C 2585f12594aSDavid Nugentflag may be used to override this behaviour. 2595f12594aSDavid NugentAs an exception to the general rule where options must follow the operation 2605f12594aSDavid Nugenttype, the 2615f12594aSDavid Nugent.Fl V 2625f12594aSDavid Nugentflag may be used on the command line before the operation keyword. 263d6f907dcSJoerg Wunsch.It Fl C Ar config 264d6f907dcSJoerg WunschBy default, 2651dcc6ec7SPhilippe Charnier.Nm 266d6f907dcSJoerg Wunschreads the file 267d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 268137db389SSteve Priceto obtain policy information on how new user accounts and groups are to be created. 269137db389SSteve PriceThe 2709fd0dafcSJoerg Wunsch.Fl C 2719fd0dafcSJoerg Wunschoption specifies a different configuration file. 272137db389SSteve PriceWhile most of the contents of the configuration file may be overridden via 273137db389SSteve Pricecommand-line options, it may be more convenient to keep standard information in a 274137db389SSteve Priceconfiguration file. 275d6f907dcSJoerg Wunsch.It Fl q 276d6f907dcSJoerg WunschUse of this option causes 2771dcc6ec7SPhilippe Charnier.Nm 278d6f907dcSJoerg Wunschto suppress error messages, which may be useful in interactive environments where it 279d6f907dcSJoerg Wunschis preferable to interpret status codes returned by 2801dcc6ec7SPhilippe Charnier.Nm 281d6f907dcSJoerg Wunschrather than messing up a carefully formatted display. 2829fd0dafcSJoerg Wunsch.It Fl N 283137db389SSteve PriceThis option is available in 284137db389SSteve Price.Ar add 285137db389SSteve Priceand 286137db389SSteve Price.Ar modify 287137db389SSteve Priceoperations, and tells 2881dcc6ec7SPhilippe Charnier.Nm 289137db389SSteve Priceto output the result of the operation without updating the user or group 290137db389SSteve Pricedatabases. 2919fd0dafcSJoerg WunschYou may use the 2929fd0dafcSJoerg Wunsch.Fl P 2939fd0dafcSJoerg Wunschoption to switch between standard passwd and readable formats. 294f1d684faSDavid Nugent.It Fl Y 295f1d684faSDavid NugentUsing this option with any of the update modes causes 2961dcc6ec7SPhilippe Charnier.Nm 297f1d684faSDavid Nugentto run 298f1d684faSDavid Nugent.Xr make 1 299f1d684faSDavid Nugentafter changing to the directory 300f1d684faSDavid Nugent.Pa /var/yp . 301490d5836SPhilippe CharnierThis is intended to allow automatic updating of 302490d5836SPhilippe Charnier.Tn NIS 303490d5836SPhilippe Charnierdatabase files. 304490d5836SPhilippe CharnierIf separate passwd and group files are being used by 305490d5836SPhilippe Charnier.Tn NIS , 306490d5836SPhilippe Charnierthen use the 307f1d684faSDavid Nugent.Fl y Ar path 308490d5836SPhilippe Charnieroption to specify the location of the 309490d5836SPhilippe Charnier.Tn NIS 310490d5836SPhilippe Charnierpasswd database so that 311137db389SSteve Price.Nm 312137db389SSteve Pricewill concurrently update it with the system password 313f1d684faSDavid Nugentdatabases. 314d6f907dcSJoerg Wunsch.El 315d6f907dcSJoerg Wunsch.Sh USER OPTIONS 316d6f907dcSJoerg WunschThe following options apply to the 317137db389SSteve Price.Ar useradd 318d6f907dcSJoerg Wunschand 319137db389SSteve Price.Ar usermod 320d6f907dcSJoerg Wunschcommands: 321d6f907dcSJoerg Wunsch.Pp 3229fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 323d6f907dcSJoerg Wunsch.It Fl n Ar name 3241dcc6ec7SPhilippe CharnierSpecify the user/account name. 325d6f907dcSJoerg Wunsch.It Fl u Ar uid 3261dcc6ec7SPhilippe CharnierSpecify the user/account numeric id. 327d6f907dcSJoerg Wunsch.Pp 328137db389SSteve PriceUsually, you only need to provide one or the other of these options, as the account 329137db389SSteve Pricename will imply the uid, or vice versa. 330137db389SSteve PriceHowever, there are times when you need to provide both. 331d6f907dcSJoerg WunschFor example, when changing the uid of an existing user with 332d6f907dcSJoerg Wunsch.Ar usermod , 333d6f907dcSJoerg Wunschor overriding the default uid when creating a new account. 334d6f907dcSJoerg WunschIf you wish 3351dcc6ec7SPhilippe Charnier.Nm 336137db389SSteve Priceto automatically allocate the uid to a new user with 337d6f907dcSJoerg Wunsch.Ar useradd , 338d6f907dcSJoerg Wunschthen you should 339d6f907dcSJoerg Wunsch.Em not 340d6f907dcSJoerg Wunschuse the 34108657612SRuslan Ermilov.Fl u 3429fd0dafcSJoerg Wunschoption. 343137db389SSteve PriceYou may also provide either the account or userid immediately after the 344137db389SSteve Price.Ar useradd , 345137db389SSteve Price.Ar userdel , 346137db389SSteve Price.Ar usermod 347137db389SSteve Priceor 348137db389SSteve Price.Ar usershow 349137db389SSteve Pricekeywords on the command line without using the 35008657612SRuslan Ermilov.Fl n 351137db389SSteve Priceor 35208657612SRuslan Ermilov.Fl u 353137db389SSteve Priceoptions. 354d6f907dcSJoerg Wunsch.El 355d6f907dcSJoerg Wunsch.Pp 356d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist" 357d6f907dcSJoerg Wunsch.It Fl c Ar comment 358d6f907dcSJoerg WunschThis field sets the contents of the passwd GECOS field, which normally contains up 359d6f907dcSJoerg Wunschto four comma-separated fields containing the user's full name, office or location, 360137db389SSteve Priceand work and home phone numbers. 361d6f907dcSJoerg WunschThese sub-fields are used by convention only, however, and are optional. 362d6f907dcSJoerg WunschIf this field is to contain spaces, you need to quote the comment itself with double 363d6f907dcSJoerg Wunschquotes 364d6f907dcSJoerg Wunsch.Ql \&" . 365d6f907dcSJoerg WunschAvoid using commas in this field as these are used as sub-field separators, and the 366d6f907dcSJoerg Wunschcolon 367d6f907dcSJoerg Wunsch.Ql \&: 368137db389SSteve Pricecharacter also cannot be used as this is the field separator for the passwd 369137db389SSteve Pricefile itself. 370d6f907dcSJoerg Wunsch.It Fl d Ar dir 371d6f907dcSJoerg WunschThis option sets the account's home directory. 372d6f907dcSJoerg WunschNormally, you will only use this if the home directory is to be different from the 373137db389SSteve Pricedefault determined from 374137db389SSteve Price.Pa /etc/pw.conf 3751dcc6ec7SPhilippe Charnier- normally 3761dcc6ec7SPhilippe Charnier.Pa /home 377137db389SSteve Pricewith the account name as a subdirectory. 378d6f907dcSJoerg Wunsch.It Fl e Ar date 3791dcc6ec7SPhilippe CharnierSet the account's expiration date. 380d6f907dcSJoerg WunschFormat of the date is either a UNIX time in decimal, or a date in 381137db389SSteve Price.Ql dd-mmm-yy[yy] 382d6f907dcSJoerg Wunschformat, where dd is the day, mmm is the month, either in numeric or alphabetic format 3831dcc6ec7SPhilippe Charnier('Jan', 'Feb', etc) and year is either a two or four digit year. 384d6f907dcSJoerg WunschThis option also accepts a relative date in the form 385d6f907dcSJoerg Wunsch.Ql \&+n[mhdwoy] 386d6f907dcSJoerg Wunschwhere 387d6f907dcSJoerg Wunsch.Ql \&n 388d6f907dcSJoerg Wunschis a decimal, octal (leading 0) or hexadecimal (leading 0x) digit followed by the 389053375e8SMike Pritchardnumber of Minutes, Hours, Days, Weeks, Months or Years from the current date at 390137db389SSteve Pricewhich the expiration date is to be set. 391d6f907dcSJoerg Wunsch.It Fl p Ar date 3921dcc6ec7SPhilippe CharnierSet the account's password expiration date. 393137db389SSteve PriceThis field is similar to the account expiration date option, except that it 394d6f907dcSJoerg Wunschapplies to forced password changes. 395137db389SSteve PriceThis is set in the same manner as the 39608657612SRuslan Ermilov.Fl e 397137db389SSteve Priceoption. 398d6f907dcSJoerg Wunsch.It Fl g Ar group 3991dcc6ec7SPhilippe CharnierSet the account's primary group to the given group. 400d6f907dcSJoerg Wunsch.Ar group 401137db389SSteve Pricemay be defined by either its name or group number. 402d6f907dcSJoerg Wunsch.It Fl G Ar grouplist 403490d5836SPhilippe CharnierSet additional group memberships for an account. 404d6f907dcSJoerg Wunsch.Ar grouplist 405137db389SSteve Priceis a comma-separated list of group names or group numbers. 406137db389SSteve PriceThe user's name is added to the group lists in 407d6f907dcSJoerg Wunsch.Pa /etc/group , 408137db389SSteve Priceand 409d6f907dcSJoerg Wunschremoved from any groups not specified in 410d6f907dcSJoerg Wunsch.Ar grouplist . 411137db389SSteve PriceNote: a user should not be added to their primary group with 412137db389SSteve Price.Ar grouplist . 413137db389SSteve PriceAlso, group membership changes do not take effect for current user login 414137db389SSteve Pricesessions, requiring the user to reconnect to be affected by the changes. 4159fd0dafcSJoerg Wunsch.It Fl L Ar class 4169fd0dafcSJoerg WunschThis option sets the login class for the user being created. 4179fd0dafcSJoerg WunschSee 4189fd0dafcSJoerg Wunsch.Xr login.conf 5 41916b4ad52SGiorgos Keramidasand 42016b4ad52SGiorgos Keramidas.Xr passwd 5 421137db389SSteve Pricefor more information on user login classes. 422d6f907dcSJoerg Wunsch.It Fl m 423d6f907dcSJoerg WunschThis option instructs 4241dcc6ec7SPhilippe Charnier.Nm 425d6f907dcSJoerg Wunschto attempt to create the user's home directory. 426d6f907dcSJoerg WunschWhile primarily useful when adding a new account with 427d6f907dcSJoerg Wunsch.Ar useradd , 428d6f907dcSJoerg Wunschthis may also be of use when moving an existing user's home directory elsewhere on 429d6f907dcSJoerg Wunschthe file system. 430d6f907dcSJoerg WunschThe new home directory is populated with the contents of the 431d6f907dcSJoerg Wunsch.Ar skeleton 432d6f907dcSJoerg Wunschdirectory, which typically contains a set of shell configuration files that the 433053375e8SMike Pritcharduser may personalize to taste. 43431e224ddSTom RhodesFiles in this directory are usually named 435fd59f59aSTom Rhodes.Pa dot . Ns Aq Ar config 43631e224ddSTom Rhodeswhere the 437fd59f59aSTom Rhodes.Pa dot 43831e224ddSTom Rhodesprefix will be stripped. 439d6f907dcSJoerg WunschWhen 44008657612SRuslan Ermilov.Fl m 441d6f907dcSJoerg Wunschis used on an account with 442d6f907dcSJoerg Wunsch.Ar usermod , 443137db389SSteve Priceexisting configuration files in the user's home directory are 444d6f907dcSJoerg Wunsch.Em not 445137db389SSteve Priceoverwritten from the skeleton files. 446d6f907dcSJoerg Wunsch.Pp 447137db389SSteve PriceWhen a user's home directory is created, it will by default be a subdirectory of the 448d6f907dcSJoerg Wunsch.Ar basehome 449137db389SSteve Pricedirectory as specified by the 45008657612SRuslan Ermilov.Fl b 451137db389SSteve Priceoption (see below), bearing the name of the new account. 452137db389SSteve PriceThis can be overridden by the 45308657612SRuslan Ermilov.Fl d 454d6f907dcSJoerg Wunschoption on the command line, if desired. 455eebbeceeSLukas Ertl.It Fl M Ar mode 456eebbeceeSLukas ErtlCreate the user's home directory with the specified 45785204142SLukas Ertl.Ar mode , 45885204142SLukas Ertlmodified by the current 45985204142SLukas Ertl.Xr umask 2 . 460eebbeceeSLukas ErtlIf omitted, it is derived from the parent process' 461eebbeceeSLukas Ertl.Xr umask 2 . 462eebbeceeSLukas ErtlThis option is only useful in combination with the 463eebbeceeSLukas Ertl.Fl m 464eebbeceeSLukas Ertlflag. 465d6f907dcSJoerg Wunsch.It Fl k Ar dir 4661dcc6ec7SPhilippe CharnierSet the 467d6f907dcSJoerg Wunsch.Ar skeleton 468137db389SSteve Pricedirectory, from which basic startup and configuration files are copied when 469d6f907dcSJoerg Wunschthe user's home directory is created. 470137db389SSteve PriceThis option only has meaning when used with the 47108657612SRuslan Ermilov.Fl d 472137db389SSteve Priceor 47308657612SRuslan Ermilov.Fl m 474137db389SSteve Priceflags. 475d6f907dcSJoerg Wunsch.It Fl s Ar shell 4761dcc6ec7SPhilippe CharnierSet or changes the user's login shell to 477d6f907dcSJoerg Wunsch.Ar shell . 478d6f907dcSJoerg WunschIf the path to the shell program is omitted, 4791dcc6ec7SPhilippe Charnier.Nm 480d6f907dcSJoerg Wunschsearches the 481d6f907dcSJoerg Wunsch.Ar shellpath 482d6f907dcSJoerg Wunschspecified in 483d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 484d6f907dcSJoerg Wunschand fills it in as appropriate. 485d6f907dcSJoerg WunschNote that unless you have a specific reason to do so, you should avoid 486d6f907dcSJoerg Wunschspecifying the path - this will allow 4871dcc6ec7SPhilippe Charnier.Nm 488d6f907dcSJoerg Wunschto validate that the program exists and is executable. 489d6f907dcSJoerg WunschSpecifying a full path (or supplying a blank "" shell) avoids this check 490d6f907dcSJoerg Wunschand allows for such entries as 4911dcc6ec7SPhilippe Charnier.Pa /nonexistent 492d6f907dcSJoerg Wunschthat should be set for accounts not intended for interactive login. 493d6f907dcSJoerg Wunsch.It Fl h Ar fd 494d6f907dcSJoerg WunschThis option provides a special interface by which interactive scripts can 495d6f907dcSJoerg Wunschset an account password using 496e97407b4SRuslan Ermilov.Nm . 497137db389SSteve PriceBecause the command line and environment are fundamentally insecure mechanisms 498d6f907dcSJoerg Wunschby which programs can accept information, 4991dcc6ec7SPhilippe Charnier.Nm 500d6f907dcSJoerg Wunschwill only allow setting of account and group passwords via a file descriptor 501d6f907dcSJoerg Wunsch(usually a pipe between an interactive script and the program). 502d6f907dcSJoerg Wunsch.Ar sh , 503d6f907dcSJoerg Wunsch.Ar bash , 504d6f907dcSJoerg Wunsch.Ar ksh 505d6f907dcSJoerg Wunschand 506d6f907dcSJoerg Wunsch.Ar perl 507137db389SSteve Priceall possess mechanisms by which this can be done. 508d6f907dcSJoerg WunschAlternatively, 509325970a9SPhilippe Charnier.Nm 510d6f907dcSJoerg Wunschwill prompt for the user's password if 51108657612SRuslan Ermilov.Fl h Ar 0 512d6f907dcSJoerg Wunschis given, nominating 513d6f907dcSJoerg Wunsch.Em stdin 514d6f907dcSJoerg Wunschas the file descriptor on which to read the password. 515137db389SSteve PriceNote that this password will be read only once and is intended 516137db389SSteve Pricefor use by a script rather than for interactive use. 517d6f907dcSJoerg WunschIf you wish to have new password confirmation along the lines of 518d6f907dcSJoerg Wunsch.Xr passwd 1 , 519137db389SSteve Pricethis must be implemented as part of an interactive script that calls 520e97407b4SRuslan Ermilov.Nm . 521d6f907dcSJoerg Wunsch.Pp 522d6f907dcSJoerg WunschIf a value of 523d6f907dcSJoerg Wunsch.Ql \&- 524d6f907dcSJoerg Wunschis given as the argument 525d6f907dcSJoerg Wunsch.Ar fd , 526d6f907dcSJoerg Wunschthen the password will be set to 527d6f907dcSJoerg Wunsch.Ql \&* , 528137db389SSteve Pricerendering the account inaccessible via password-based login. 52987d6b5caSIan Dowse.It Fl H Ar fd 53087d6b5caSIan DowseRead an encrypted password string from the specified file descriptor. 53187d6b5caSIan DowseThis is like 53287d6b5caSIan Dowse.Fl h , 53387d6b5caSIan Dowsebut the password should be supplied already encrypted in a form 53487d6b5caSIan Dowsesuitable for writing directly to the password database. 535d6f907dcSJoerg Wunsch.El 536d6f907dcSJoerg Wunsch.Pp 537d6f907dcSJoerg WunschIt is possible to use 538d6f907dcSJoerg Wunsch.Ar useradd 539d6f907dcSJoerg Wunschto create a new account that duplicates an existing user id. 540d6f907dcSJoerg WunschWhile this is normally considered an error and will be rejected, the 54108657612SRuslan Ermilov.Fl o 5429fd0dafcSJoerg Wunschoption overrides the check for duplicates and allows the duplication of 5439fd0dafcSJoerg Wunschthe user id. 5449fd0dafcSJoerg WunschThis may be useful if you allow the same user to login under 5459fd0dafcSJoerg Wunschdifferent contexts (different group allocations, different home 5469fd0dafcSJoerg Wunschdirectory, different shell) while providing basically the same 5479fd0dafcSJoerg Wunschpermissions for access to the user's files in each account. 548d6f907dcSJoerg Wunsch.Pp 549d6f907dcSJoerg WunschThe 550d6f907dcSJoerg Wunsch.Ar useradd 551d6f907dcSJoerg Wunschcommand also has the ability to set new user and group defaults by using the 55208657612SRuslan Ermilov.Fl D 5539fd0dafcSJoerg Wunschoption. 554d6f907dcSJoerg WunschInstead of adding a new user, 5551dcc6ec7SPhilippe Charnier.Nm 556d6f907dcSJoerg Wunschwrites a new set of defaults to its configuration file, 557d6f907dcSJoerg Wunsch.Pa /etc/pw.conf . 558d6f907dcSJoerg WunschWhen using the 55908657612SRuslan Ermilov.Fl D 5609fd0dafcSJoerg Wunschoption, you must not use either 56108657612SRuslan Ermilov.Fl n Ar name 562d6f907dcSJoerg Wunschor 56308657612SRuslan Ermilov.Fl u Ar uid 564d6f907dcSJoerg Wunschor an error will result. 565d6f907dcSJoerg WunschUse of 56608657612SRuslan Ermilov.Fl D 5679fd0dafcSJoerg Wunschchanges the meaning of several command line switches in the 568d6f907dcSJoerg Wunsch.Ar useradd 569d6f907dcSJoerg Wunschcommand. 570d6f907dcSJoerg WunschThese are: 571d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist" 572d6f907dcSJoerg Wunsch.It Fl D 573d6f907dcSJoerg WunschSet default values in 574d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 575d6f907dcSJoerg Wunschconfiguration file, or a different named configuration file if the 57608657612SRuslan Ermilov.Fl C Ar config 5779fd0dafcSJoerg Wunschoption is used. 578d6f907dcSJoerg Wunsch.It Fl b Ar dir 5791dcc6ec7SPhilippe CharnierSet the root directory in which user home directories are created. 580d6f907dcSJoerg WunschThe default value for this is 5811dcc6ec7SPhilippe Charnier.Pa /home , 582d6f907dcSJoerg Wunschbut it may be set elsewhere as desired. 583d6f907dcSJoerg Wunsch.It Fl e Ar days 5841dcc6ec7SPhilippe CharnierSet the default account expiration period in days. 585d6f907dcSJoerg WunschUnlike use without 58608657612SRuslan Ermilov.Fl D , 587d6f907dcSJoerg Wunschthe argument must be numeric, which specifies the number of days after creation when 588d6f907dcSJoerg Wunschthe account is to expire. 589d6f907dcSJoerg WunschA value of 0 suppresses automatic calculation of the expiry date. 590d6f907dcSJoerg Wunsch.It Fl p Ar days 5911dcc6ec7SPhilippe CharnierSet the default password expiration period in days. 592d6f907dcSJoerg Wunsch.It Fl g Ar group 5931dcc6ec7SPhilippe CharnierSet the default group for new users. 594d6f907dcSJoerg WunschIf a blank group is specified using 59508657612SRuslan Ermilov.Fl g Ar \&"" , 596137db389SSteve Pricethen new users will be allocated their own private primary group 597137db389SSteve Pricewith the same name as their login name. 598d6f907dcSJoerg WunschIf a group is supplied, either its name or uid may be given as an argument. 599d6f907dcSJoerg Wunsch.It Fl G Ar grouplist 600137db389SSteve PriceSet the default groups in which new users are granted membership. 601d6f907dcSJoerg WunschThis is a separate set of groups from the primary group, and you should avoid 602137db389SSteve Pricenominating the same group as both primary and extra groups. 603d6f907dcSJoerg WunschIn other words, these extra groups determine membership in groups 604d6f907dcSJoerg Wunsch.Em other than 605d6f907dcSJoerg Wunschthe primary group. 606d6f907dcSJoerg Wunsch.Ar grouplist 607137db389SSteve Priceis a comma-separated list of group names or ids, and are always 608d6f907dcSJoerg Wunschstored in 609d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 610d6f907dcSJoerg Wunschby their symbolic names. 6119fd0dafcSJoerg Wunsch.It Fl L Ar class 6129fd0dafcSJoerg WunschThis option sets the default login class for new users. 613d6f907dcSJoerg Wunsch.It Fl k Ar dir 6141dcc6ec7SPhilippe CharnierSet the default 615d6f907dcSJoerg Wunsch.Em skeleton 616053375e8SMike Pritcharddirectory, from which prototype shell and other initialization files are copied when 6171dcc6ec7SPhilippe Charnier.Nm 618d6f907dcSJoerg Wunschcreates a user's home directory. 61931e224ddSTom RhodesSee description of 62031e224ddSTom Rhodes.Fl k 62131e224ddSTom Rhodesfor naming conventions of these files. 622610a5778SRuslan Ermilov.It Xo 623610a5778SRuslan Ermilov.Fl u Ar min , Ns Ar max , 624610a5778SRuslan Ermilov.Fl i Ar min , Ns Ar max 625610a5778SRuslan Ermilov.Xc 6269fd0dafcSJoerg WunschThese options set the minimum and maximum user and group ids allocated for new accounts 627d6f907dcSJoerg Wunschand groups created by 628e97407b4SRuslan Ermilov.Nm . 629d6f907dcSJoerg WunschThe default values for each is 1000 minimum and 32000 maximum. 630d6f907dcSJoerg Wunsch.Ar min 631d6f907dcSJoerg Wunschand 632d6f907dcSJoerg Wunsch.Ar max 633d6f907dcSJoerg Wunschare both numbers, where max must be greater than min, and both must be between 0 634d6f907dcSJoerg Wunschand 32767. 635d6f907dcSJoerg WunschIn general, user and group ids less than 100 are reserved for use by the system, 636d6f907dcSJoerg Wunschand numbers greater than 32000 may also be reserved for special purposes (used by 637d6f907dcSJoerg Wunschsome system daemons). 638d6f907dcSJoerg Wunsch.It Fl w Ar method 639d6f907dcSJoerg WunschThe 64008657612SRuslan Ermilov.Fl w 6419fd0dafcSJoerg Wunschoption sets the default method used to set passwords for newly created user accounts. 642d6f907dcSJoerg Wunsch.Ar method 643d6f907dcSJoerg Wunschis one of: 644d6f907dcSJoerg Wunsch.Pp 645d6f907dcSJoerg Wunsch.Bl -tag -width random -offset indent -compact 646d6f907dcSJoerg Wunsch.It no 6471dcc6ec7SPhilippe Charnierdisable login on newly created accounts 648d6f907dcSJoerg Wunsch.It yes 6491dcc6ec7SPhilippe Charnierforce the password to be the account name 650d6f907dcSJoerg Wunsch.It none 6511dcc6ec7SPhilippe Charnierforce a blank password 652d6f907dcSJoerg Wunsch.It random 6531dcc6ec7SPhilippe Charniergenerate a random password 654d6f907dcSJoerg Wunsch.El 655d6f907dcSJoerg Wunsch.Pp 656d6f907dcSJoerg WunschThe 657d6f907dcSJoerg Wunsch.Ql \&random 658d6f907dcSJoerg Wunschor 659d6f907dcSJoerg Wunsch.Ql \&no 660d6f907dcSJoerg Wunschmethods are the most secure; in the former case, 6611dcc6ec7SPhilippe Charnier.Nm 662d6f907dcSJoerg Wunschgenerates a password and prints it to stdout, which is suitable where you issue 663d6f907dcSJoerg Wunschusers with passwords to access their accounts rather than having the user nominate 664d6f907dcSJoerg Wunschtheir own (possibly poorly chosen) password. 665d6f907dcSJoerg WunschThe 666d6f907dcSJoerg Wunsch.Ql \&no 667d6f907dcSJoerg Wunschmethod requires that the superuser use 668d6f907dcSJoerg Wunsch.Xr passwd 1 669d6f907dcSJoerg Wunschto render the account accessible with a password. 670f1d684faSDavid Nugent.It Fl y Ar path 671490d5836SPhilippe CharnierThis sets the pathname of the database used by 672490d5836SPhilippe Charnier.Tn NIS 673490d5836SPhilippe Charnierif you are not sharing 674f1d684faSDavid Nugentthe information from 675f1d684faSDavid Nugent.Pa /etc/master.passwd 676490d5836SPhilippe Charnierdirectly with 677490d5836SPhilippe Charnier.Tn NIS . 678490d5836SPhilippe CharnierYou should only set this option for 679490d5836SPhilippe Charnier.Tn NIS 680490d5836SPhilippe Charnierservers. 681d6f907dcSJoerg Wunsch.El 682d6f907dcSJoerg Wunsch.Pp 683d6f907dcSJoerg WunschThe 684d6f907dcSJoerg Wunsch.Ar userdel 685f2e366a1SSheldon Hearncommand has only three valid options. 686f2e366a1SSheldon HearnThe 68708657612SRuslan Ermilov.Fl n Ar name 688d6f907dcSJoerg Wunschand 68908657612SRuslan Ermilov.Fl u Ar uid 6909fd0dafcSJoerg Wunschoptions have already been covered above. 6919fd0dafcSJoerg WunschThe additional option is: 6929fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 693d6f907dcSJoerg Wunsch.It Fl r 694d6f907dcSJoerg WunschThis tells 6951dcc6ec7SPhilippe Charnier.Nm 696d6f907dcSJoerg Wunschto remove the user's home directory and all of its contents. 697490d5836SPhilippe CharnierThe 698490d5836SPhilippe Charnier.Nm 699490d5836SPhilippe Charnierutility errs on the side of caution when removing files from the system. 700d6f907dcSJoerg WunschFirstly, it will not do so if the uid of the account being removed is also used by 701d6f907dcSJoerg Wunschanother account on the system, and the 'home' directory in the password file is 702d6f907dcSJoerg Wunscha valid path that commences with the character 703d6f907dcSJoerg Wunsch.Ql \&/ . 704d6f907dcSJoerg WunschSecondly, it will only remove files and directories that are actually owned by 705d6f907dcSJoerg Wunschthe user, or symbolic links owned by anyone under the user's home directory. 706d6f907dcSJoerg WunschFinally, after deleting all contents owned by the user only empty directories 707d6f907dcSJoerg Wunschwill be removed. 708053375e8SMike PritchardIf any additional cleanup work is required, this is left to the administrator. 709d6f907dcSJoerg Wunsch.El 710d6f907dcSJoerg Wunsch.Pp 711d6f907dcSJoerg WunschMail spool files and crontabs are always removed when an account is deleted as these 712d6f907dcSJoerg Wunschare unconditionally attached to the user name. 713d6f907dcSJoerg WunschJobs queued for processing by 714d6f907dcSJoerg Wunsch.Ar at 715137db389SSteve Priceare also removed if the user's uid is unique and not also used by another account on the 716137db389SSteve Pricesystem. 717d6f907dcSJoerg Wunsch.Pp 718d6f907dcSJoerg WunschThe 719d6f907dcSJoerg Wunsch.Ar usershow 720d6f907dcSJoerg Wunschcommand allows viewing of an account in one of two formats. 721d6f907dcSJoerg WunschBy default, the format is identical to the format used in 722d6f907dcSJoerg Wunsch.Pa /etc/master.passwd 723d6f907dcSJoerg Wunschwith the password field replaced with a 724d6f907dcSJoerg Wunsch.Ql \&* . 725d6f907dcSJoerg WunschIf the 72608657612SRuslan Ermilov.Fl P 7279fd0dafcSJoerg Wunschoption is used, then 7281dcc6ec7SPhilippe Charnier.Nm 729d6f907dcSJoerg Wunschoutputs the account details in a more human readable form. 7304731d076SDima DorfmanIf the 7314731d076SDima Dorfman.Fl 7 7324731d076SDima Dorfmanoption is used, the account details are shown in v7 format. 733d6f907dcSJoerg WunschThe 73408657612SRuslan Ermilov.Fl a 7359fd0dafcSJoerg Wunschoption lists all users currently on file. 736466c257cSDima DorfmanUsing 737466c257cSDima Dorfman.Fl F 738466c257cSDima Dorfmanforces 739466c257cSDima Dorfman.Nm 740466c257cSDima Dorfmanto print the details of an account even if it does not exist. 7419fd0dafcSJoerg Wunsch.Pp 7429fd0dafcSJoerg WunschThe command 7439fd0dafcSJoerg Wunsch.Ar usernext 7449fd0dafcSJoerg Wunschreturns the next available user and group ids separated by a colon. 7459fd0dafcSJoerg WunschThis is normally of interest only to interactive scripts or front-ends 7469fd0dafcSJoerg Wunschthat use 747e97407b4SRuslan Ermilov.Nm . 748d6f907dcSJoerg Wunsch.Sh GROUP OPTIONS 749d6f907dcSJoerg WunschThe 75008657612SRuslan Ermilov.Fl C 751d6f907dcSJoerg Wunschand 75208657612SRuslan Ermilov.Fl q 7539fd0dafcSJoerg Wunschoptions (explained at the start of the previous section) are available 7549fd0dafcSJoerg Wunschwith the group manipulation commands. 755d6f907dcSJoerg WunschOther common options to all group-related commands are: 7569fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers" 757d6f907dcSJoerg Wunsch.It Fl n Ar name 7581dcc6ec7SPhilippe CharnierSpecify the group name. 759d6f907dcSJoerg Wunsch.It Fl g Ar gid 7601dcc6ec7SPhilippe CharnierSpecify the group numeric id. 761d6f907dcSJoerg Wunsch.Pp 7629fd0dafcSJoerg WunschAs with the account name and id fields, you will usually only need 7639fd0dafcSJoerg Wunschto supply one of these, as the group name implies the uid and vice 7649fd0dafcSJoerg Wunschversa. 7659fd0dafcSJoerg WunschYou will only need to use both when setting a specific group id 7669fd0dafcSJoerg Wunschagainst a new group or when changing the uid of an existing group. 7677ecd7a42SJoseph Koshy.It Fl M Ar memberlist 7689fd0dafcSJoerg WunschThis option provides an alternative way to add existing users to a 7699fd0dafcSJoerg Wunschnew group (in groupadd) or replace an existing membership list (in 7709fd0dafcSJoerg Wunschgroupmod). 7719fd0dafcSJoerg Wunsch.Ar memberlist 7729fd0dafcSJoerg Wunschis a comma separated list of valid and existing user names or uids. 7739fd0dafcSJoerg Wunsch.It Fl m Ar newmembers 7749fd0dafcSJoerg WunschSimilar to 77508657612SRuslan Ermilov.Fl M , 7769fd0dafcSJoerg Wunschthis option allows the 7779fd0dafcSJoerg Wunsch.Em addition 778137db389SSteve Priceof existing users to a group without replacing the existing list of 7799fd0dafcSJoerg Wunschmembers. 780137db389SSteve PriceLogin names or user ids may be used, and duplicate users are 781137db389SSteve Pricesilently eliminated. 782d6f907dcSJoerg Wunsch.El 783d6f907dcSJoerg Wunsch.Pp 784d6f907dcSJoerg Wunsch.Ar groupadd 785d6f907dcSJoerg Wunschalso has a 78608657612SRuslan Ermilov.Fl o 787137db389SSteve Priceoption that allows allocation of an existing group id to a new group. 788d6f907dcSJoerg WunschThe default action is to reject an attempt to add a group, and this option overrides 789d6f907dcSJoerg Wunschthe check for duplicate group ids. 790d6f907dcSJoerg WunschThere is rarely any need to duplicate a group id. 791d6f907dcSJoerg Wunsch.Pp 792d6f907dcSJoerg WunschThe 793d6f907dcSJoerg Wunsch.Ar groupmod 794137db389SSteve Pricecommand adds one additional option: 795d6f907dcSJoerg Wunsch.Pp 7969fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers" 797d6f907dcSJoerg Wunsch.It Fl l Ar name 798d6f907dcSJoerg WunschThis option allows changing of an existing group name to 799d6f907dcSJoerg Wunsch.Ql \&name . 800d6f907dcSJoerg WunschThe new name must not already exist, and any attempt to duplicate an existing group 801d6f907dcSJoerg Wunschname will be rejected. 802d6f907dcSJoerg Wunsch.El 803d6f907dcSJoerg Wunsch.Pp 804d6f907dcSJoerg WunschOptions for 805d6f907dcSJoerg Wunsch.Ar groupshow 806d6f907dcSJoerg Wunschare the same as for 807d6f907dcSJoerg Wunsch.Ar usershow , 808d6f907dcSJoerg Wunschwith the 80908657612SRuslan Ermilov.Fl g Ar gid 810d6f907dcSJoerg Wunschreplacing 81108657612SRuslan Ermilov.Fl u Ar uid 812d6f907dcSJoerg Wunschto specify the group id. 8134731d076SDima DorfmanThe 8144731d076SDima Dorfman.Fl 7 8154731d076SDima Dorfmanoption does not apply to the 8164731d076SDima Dorfman.Ar groupshow 8174731d076SDima Dorfmancommand. 818d6f907dcSJoerg Wunsch.Pp 8199fd0dafcSJoerg WunschThe command 8209fd0dafcSJoerg Wunsch.Ar groupnext 8219fd0dafcSJoerg Wunschreturns the next available group id on standard output. 822e468afb4SDima Dorfman.Sh USER LOCKING 823490d5836SPhilippe CharnierThe 824490d5836SPhilippe Charnier.Nm 825490d5836SPhilippe Charnierutility 826e468afb4SDima Dorfmansupports a simple password locking mechanism for users; it works by 827e468afb4SDima Dorfmanprepending the string 828e468afb4SDima Dorfman.Ql *LOCKED* 829e468afb4SDima Dorfmanto the beginning of the password field in 830e468afb4SDima Dorfman.Pa master.passwd 831e468afb4SDima Dorfmanto prevent successful authentication. 832e468afb4SDima Dorfman.Pp 833e468afb4SDima DorfmanThe 834e468afb4SDima Dorfman.Ar lock 835e468afb4SDima Dorfmanand 836e468afb4SDima Dorfman.Ar unlock 837e468afb4SDima Dorfmancommands take a user name or uid of the account to lock or unlock, 83807bfccd7SRuslan Ermilovrespectively. 83907bfccd7SRuslan ErmilovThe 84008657612SRuslan Ermilov.Fl V , 84108657612SRuslan Ermilov.Fl C , 842e468afb4SDima Dorfmanand 84308657612SRuslan Ermilov.Fl q 844e468afb4SDima Dorfmanoptions as described above are accepted by these commands. 84559a3c79dSRuslan Ermilov.Sh NOTES 84659a3c79dSRuslan ErmilovFor a summary of options available with each command, you can use 84759a3c79dSRuslan Ermilov.Dl pw [command] help 84859a3c79dSRuslan ErmilovFor example, 84959a3c79dSRuslan Ermilov.Dl pw useradd help 85059a3c79dSRuslan Ermilovlists all available options for the useradd operation. 85159a3c79dSRuslan Ermilov.Pp 85259a3c79dSRuslan ErmilovThe 85359a3c79dSRuslan Ermilov.Nm 85459a3c79dSRuslan Ermilovutility allows 8-bit characters in the passwd GECOS field (user's full name, 85559a3c79dSRuslan Ermilovoffice, work and home phone number subfields), but disallows them in 85659a3c79dSRuslan Ermilovuser login and group names. 85759a3c79dSRuslan ErmilovUse 8-bit characters with caution, as connection to the Internet will 85859a3c79dSRuslan Ermilovrequire that your mail transport program supports 8BITMIME, and will 85959a3c79dSRuslan Ermilovconvert headers containing 8-bit characters to 7-bit quoted-printable 86059a3c79dSRuslan Ermilovformat. 86159a3c79dSRuslan Ermilov.Xr sendmail 8 86259a3c79dSRuslan Ermilovdoes support this. 86359a3c79dSRuslan ErmilovUse of 8-bit characters in the GECOS field should be used in 86459a3c79dSRuslan Ermilovconjunction with the user's default locale and character set 86559a3c79dSRuslan Ermilovand should not be implemented without their use. 86659a3c79dSRuslan ErmilovUsing 8-bit characters may also affect other 86759a3c79dSRuslan Ermilovprograms that transmit the contents of the GECOS field over the 86859a3c79dSRuslan ErmilovInternet, such as 86959a3c79dSRuslan Ermilov.Xr fingerd 8 , 87059a3c79dSRuslan Ermilovand a small number of TCP/IP clients, such as IRC, where full names 87159a3c79dSRuslan Ermilovspecified in the passwd file may be used by default. 87259a3c79dSRuslan Ermilov.Pp 87359a3c79dSRuslan ErmilovThe 87459a3c79dSRuslan Ermilov.Nm 87559a3c79dSRuslan Ermilovutility writes a log to the 87659a3c79dSRuslan Ermilov.Pa /var/log/userlog 87759a3c79dSRuslan Ermilovfile when actions such as user or group additions or deletions occur. 87859a3c79dSRuslan ErmilovThe location of this logfile can be changed in 87959a3c79dSRuslan Ermilov.Xr pw.conf 5 . 88059a3c79dSRuslan Ermilov.Sh FILES 88159a3c79dSRuslan Ermilov.Bl -tag -width /etc/master.passwd.new -compact 88259a3c79dSRuslan Ermilov.It Pa /etc/master.passwd 88359a3c79dSRuslan ErmilovThe user database 88459a3c79dSRuslan Ermilov.It Pa /etc/passwd 88559a3c79dSRuslan ErmilovA Version 7 format password file 88659a3c79dSRuslan Ermilov.It Pa /etc/login.conf 88759a3c79dSRuslan ErmilovThe user capabilities database 88859a3c79dSRuslan Ermilov.It Pa /etc/group 88959a3c79dSRuslan ErmilovThe group database 89059a3c79dSRuslan Ermilov.It Pa /etc/master.passwd.new 89159a3c79dSRuslan ErmilovTemporary copy of the master password file 89259a3c79dSRuslan Ermilov.It Pa /etc/passwd.new 89359a3c79dSRuslan ErmilovTemporary copy of the Version 7 password file 89459a3c79dSRuslan Ermilov.It Pa /etc/group.new 89559a3c79dSRuslan ErmilovTemporary copy of the group file 89659a3c79dSRuslan Ermilov.It Pa /etc/pw.conf 89759a3c79dSRuslan ErmilovPw default options file 89859a3c79dSRuslan Ermilov.It Pa /var/log/userlog 89959a3c79dSRuslan ErmilovUser/group modification logfile 90059a3c79dSRuslan Ermilov.El 901a866e170SRuslan Ermilov.Sh EXIT STATUS 902490d5836SPhilippe CharnierThe 903490d5836SPhilippe Charnier.Nm 904490d5836SPhilippe Charnierutility returns EXIT_SUCCESS on successful operation, otherwise 905137db389SSteve Price.Nm 906137db389SSteve Pricereturns one of the 9079fd0dafcSJoerg Wunschfollowing exit codes defined by 9089fd0dafcSJoerg Wunsch.Xr sysexits 3 9099fd0dafcSJoerg Wunschas follows: 9109fd0dafcSJoerg Wunsch.Bl -tag -width xxxx 9119fd0dafcSJoerg Wunsch.It EX_USAGE 9129fd0dafcSJoerg Wunsch.Bl -bullet -compact 9139fd0dafcSJoerg Wunsch.It 9141dcc6ec7SPhilippe CharnierCommand line syntax errors (invalid keyword, unknown option). 9159fd0dafcSJoerg Wunsch.El 9169fd0dafcSJoerg Wunsch.It EX_NOPERM 9179fd0dafcSJoerg Wunsch.Bl -bullet -compact 9189fd0dafcSJoerg Wunsch.It 9199fd0dafcSJoerg WunschAttempting to run one of the update modes as non-root. 9209fd0dafcSJoerg Wunsch.El 9219fd0dafcSJoerg Wunsch.It EX_OSERR 9229fd0dafcSJoerg Wunsch.Bl -bullet -compact 9239fd0dafcSJoerg Wunsch.It 9249fd0dafcSJoerg WunschMemory allocation error. 9259fd0dafcSJoerg Wunsch.It 9269fd0dafcSJoerg WunschRead error from password file descriptor. 9279fd0dafcSJoerg Wunsch.El 9289fd0dafcSJoerg Wunsch.It EX_DATAERR 9299fd0dafcSJoerg Wunsch.Bl -bullet -compact 9309fd0dafcSJoerg Wunsch.It 9319fd0dafcSJoerg WunschBad or invalid data provided or missing on the command line or 932137db389SSteve Pricevia the password file descriptor. 9339fd0dafcSJoerg Wunsch.It 9349fd0dafcSJoerg WunschAttempted to remove, rename root account or change its uid. 9359fd0dafcSJoerg Wunsch.El 9369fd0dafcSJoerg Wunsch.It EX_OSFILE 9379fd0dafcSJoerg Wunsch.Bl -bullet -compact 9389fd0dafcSJoerg Wunsch.It 9399fd0dafcSJoerg WunschSkeleton directory is invalid or does not exist. 9409fd0dafcSJoerg Wunsch.It 9419fd0dafcSJoerg WunschBase home directory is invalid or does not exist. 9429fd0dafcSJoerg Wunsch.It 943137db389SSteve PriceInvalid or non-existent shell specified. 9449fd0dafcSJoerg Wunsch.El 9459fd0dafcSJoerg Wunsch.It EX_NOUSER 9469fd0dafcSJoerg Wunsch.Bl -bullet -compact 9479fd0dafcSJoerg Wunsch.It 9489fd0dafcSJoerg WunschUser, user id, group or group id specified does not exist. 9499fd0dafcSJoerg Wunsch.It 950137db389SSteve PriceUser or group recorded, added, or modified unexpectedly disappeared. 9519fd0dafcSJoerg Wunsch.El 9529fd0dafcSJoerg Wunsch.It EX_SOFTWARE 9539fd0dafcSJoerg Wunsch.Bl -bullet -compact 9549fd0dafcSJoerg Wunsch.It 9559fd0dafcSJoerg WunschNo more group or user ids available within specified range. 9569fd0dafcSJoerg Wunsch.El 9579fd0dafcSJoerg Wunsch.It EX_IOERR 9589fd0dafcSJoerg Wunsch.Bl -bullet -compact 9599fd0dafcSJoerg Wunsch.It 9609fd0dafcSJoerg WunschUnable to rewrite configuration file. 9619fd0dafcSJoerg Wunsch.It 9629fd0dafcSJoerg WunschError updating group or user database files. 9639fd0dafcSJoerg Wunsch.It 9649fd0dafcSJoerg WunschUpdate error for passwd or group database files. 9659fd0dafcSJoerg Wunsch.El 9669fd0dafcSJoerg Wunsch.It EX_CONFIG 9679fd0dafcSJoerg Wunsch.Bl -bullet -compact 9689fd0dafcSJoerg Wunsch.It 9699fd0dafcSJoerg WunschNo base home directory configured. 9709fd0dafcSJoerg Wunsch.El 9719fd0dafcSJoerg Wunsch.El 972d6f907dcSJoerg Wunsch.Sh SEE ALSO 973d6f907dcSJoerg Wunsch.Xr chpass 1 , 974053375e8SMike Pritchard.Xr passwd 1 , 975eebbeceeSLukas Ertl.Xr umask 2 , 976d6f907dcSJoerg Wunsch.Xr group 5 , 977bfd34a4aSWolfram Schneider.Xr login.conf 5 , 978053375e8SMike Pritchard.Xr passwd 5 , 979053375e8SMike Pritchard.Xr pw.conf 5 , 980d6f907dcSJoerg Wunsch.Xr pwd_mkdb 8 , 981053375e8SMike Pritchard.Xr vipw 8 982d6f907dcSJoerg Wunsch.Sh HISTORY 983490d5836SPhilippe CharnierThe 984490d5836SPhilippe Charnier.Nm 985490d5836SPhilippe Charnierutility was written to mimic many of the options used in the SYSV 986d6f907dcSJoerg Wunsch.Em shadow 9879fd0dafcSJoerg Wunschsupport suite, but is modified for passwd and group fields specific to 988053375e8SMike Pritchardthe 989053375e8SMike Pritchard.Bx 4.4 9909fd0dafcSJoerg Wunschoperating system, and combines all of the major elements 9919fd0dafcSJoerg Wunschinto a single command. 992