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.\" 274369c82dSBaptiste Daroussin.Dd June 14, 2015 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 35a5b912ffSGlen Barber.Op Fl R Ar rootdir 365f12594aSDavid Nugent.Op Fl V Ar etcdir 37d6f907dcSJoerg Wunsch.Ar useradd 38*1e4d5cf1SDevin Teske.Oo Fl n Oc name Oo Fl u Ar uid Oc 39d6f907dcSJoerg Wunsch.Op Fl C Ar config 40d6f907dcSJoerg Wunsch.Op Fl q 41d6f907dcSJoerg Wunsch.Op Fl c Ar comment 42d6f907dcSJoerg Wunsch.Op Fl d Ar dir 43d6f907dcSJoerg Wunsch.Op Fl e Ar date 44d6f907dcSJoerg Wunsch.Op Fl p Ar date 45d6f907dcSJoerg Wunsch.Op Fl g Ar group 46d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist 47d6f907dcSJoerg Wunsch.Op Fl m 48eebbeceeSLukas Ertl.Op Fl M Ar mode 49d6f907dcSJoerg Wunsch.Op Fl k Ar dir 50f5875822SSADA Kenji.Op Fl w Ar method 51d6f907dcSJoerg Wunsch.Op Fl s Ar shell 52d6f907dcSJoerg Wunsch.Op Fl o 53d6f907dcSJoerg Wunsch.Op Fl L Ar class 5487d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 559fd0dafcSJoerg Wunsch.Op Fl N 569fd0dafcSJoerg Wunsch.Op Fl P 57f1d684faSDavid Nugent.Op Fl Y 58e97407b4SRuslan Ermilov.Nm 59a5b912ffSGlen Barber.Op Fl R Ar rootdir 605f12594aSDavid Nugent.Op Fl V Ar etcdir 61d6f907dcSJoerg Wunsch.Ar useradd 62f1d684faSDavid Nugent.Fl D 63d6f907dcSJoerg Wunsch.Op Fl C Ar config 64d6f907dcSJoerg Wunsch.Op Fl q 65d6f907dcSJoerg Wunsch.Op Fl b Ar dir 66d6f907dcSJoerg Wunsch.Op Fl e Ar days 67d6f907dcSJoerg Wunsch.Op Fl p Ar days 68d6f907dcSJoerg Wunsch.Op Fl g Ar group 69d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist 70d6f907dcSJoerg Wunsch.Op Fl k Ar dir 7185204142SLukas Ertl.Op Fl M Ar mode 72610a5778SRuslan Ermilov.Op Fl u Ar min , Ns Ar max 73610a5778SRuslan Ermilov.Op Fl i Ar min , Ns Ar max 74d6f907dcSJoerg Wunsch.Op Fl w Ar method 75d6f907dcSJoerg Wunsch.Op Fl s Ar shell 76f1d684faSDavid Nugent.Op Fl y Ar path 77e97407b4SRuslan Ermilov.Nm 78a5b912ffSGlen Barber.Op Fl R Ar rootdir 795f12594aSDavid Nugent.Op Fl V Ar etcdir 80d6f907dcSJoerg Wunsch.Ar userdel 81*1e4d5cf1SDevin Teske.Oo Fl n Oc name|uid | Fl u Ar uid 82d6f907dcSJoerg Wunsch.Op Fl r 83f1d684faSDavid Nugent.Op Fl Y 84e97407b4SRuslan Ermilov.Nm 85a5b912ffSGlen Barber.Op Fl R Ar rootdir 865f12594aSDavid Nugent.Op Fl V Ar etcdir 87d6f907dcSJoerg Wunsch.Ar usermod 88*1e4d5cf1SDevin Teske.Oo Fl n Oc name|uid Oo Fl u Ar newuid Oc | Fl u Ar uid 89d6f907dcSJoerg Wunsch.Op Fl C Ar config 90d6f907dcSJoerg Wunsch.Op Fl q 91d6f907dcSJoerg Wunsch.Op Fl c Ar comment 92d6f907dcSJoerg Wunsch.Op Fl d Ar dir 93d6f907dcSJoerg Wunsch.Op Fl e Ar date 94d6f907dcSJoerg Wunsch.Op Fl p Ar date 95d6f907dcSJoerg Wunsch.Op Fl g Ar group 96d6f907dcSJoerg Wunsch.Op Fl G Ar grouplist 97*1e4d5cf1SDevin Teske.Op Fl l Ar newname 98d6f907dcSJoerg Wunsch.Op Fl m 99eebbeceeSLukas Ertl.Op Fl M Ar mode 100d6f907dcSJoerg Wunsch.Op Fl k Ar dir 1019fd0dafcSJoerg Wunsch.Op Fl w Ar method 102d6f907dcSJoerg Wunsch.Op Fl s Ar shell 103d6f907dcSJoerg Wunsch.Op Fl L Ar class 10487d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1059fd0dafcSJoerg Wunsch.Op Fl N 1069fd0dafcSJoerg Wunsch.Op Fl P 107f1d684faSDavid Nugent.Op Fl Y 108e97407b4SRuslan Ermilov.Nm 109a5b912ffSGlen Barber.Op Fl R Ar rootdir 1105f12594aSDavid Nugent.Op Fl V Ar etcdir 111d6f907dcSJoerg Wunsch.Ar usershow 112*1e4d5cf1SDevin Teske.Oo Fl n Oc name|uid | Fl u Ar uid 113d6f907dcSJoerg Wunsch.Op Fl F 1149fd0dafcSJoerg Wunsch.Op Fl P 1154731d076SDima Dorfman.Op Fl 7 116d6f907dcSJoerg Wunsch.Op Fl a 117e97407b4SRuslan Ermilov.Nm 118a5b912ffSGlen Barber.Op Fl R Ar rootdir 1195f12594aSDavid Nugent.Op Fl V Ar etcdir 1209fd0dafcSJoerg Wunsch.Ar usernext 1219fd0dafcSJoerg Wunsch.Op Fl C Ar config 1223bfc59e8SBaptiste Daroussin.Op Fl q 123e97407b4SRuslan Ermilov.Nm 124a5b912ffSGlen Barber.Op Fl R Ar rootdir 1255f12594aSDavid Nugent.Op Fl V Ar etcdir 126d6f907dcSJoerg Wunsch.Ar groupadd 127*1e4d5cf1SDevin Teske.Oo Fl n Oc name Oo Fl g Ar gid Oc 128d6f907dcSJoerg Wunsch.Op Fl C Ar config 129d6f907dcSJoerg Wunsch.Op Fl q 1309fd0dafcSJoerg Wunsch.Op Fl M Ar members 131d6f907dcSJoerg Wunsch.Op Fl o 13287d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1339fd0dafcSJoerg Wunsch.Op Fl N 1349fd0dafcSJoerg Wunsch.Op Fl P 135f1d684faSDavid Nugent.Op Fl Y 136e97407b4SRuslan Ermilov.Nm 137a5b912ffSGlen Barber.Op Fl R Ar rootdir 1385f12594aSDavid Nugent.Op Fl V Ar etcdir 139d6f907dcSJoerg Wunsch.Ar groupdel 140*1e4d5cf1SDevin Teske.Oo Fl n Oc name|gid | Fl g Ar gid 141f1d684faSDavid Nugent.Op Fl Y 142e97407b4SRuslan Ermilov.Nm 143a5b912ffSGlen Barber.Op Fl R Ar rootdir 1445f12594aSDavid Nugent.Op Fl V Ar etcdir 145d6f907dcSJoerg Wunsch.Ar groupmod 146*1e4d5cf1SDevin Teske.Oo Fl n Oc name|gid Oo Fl g Ar newgid Oc | Fl g Ar gid 147d6f907dcSJoerg Wunsch.Op Fl C Ar config 148d6f907dcSJoerg Wunsch.Op Fl q 149*1e4d5cf1SDevin Teske.Op Fl l Ar newname 1509fd0dafcSJoerg Wunsch.Op Fl M Ar members 1519fd0dafcSJoerg Wunsch.Op Fl m Ar newmembers 152bc991a6dSSean Farley.Op Fl d Ar oldmembers 15387d6b5caSIan Dowse.Op Fl h Ar fd | Fl H Ar fd 1549fd0dafcSJoerg Wunsch.Op Fl N 1559fd0dafcSJoerg Wunsch.Op Fl P 156f1d684faSDavid Nugent.Op Fl Y 157e97407b4SRuslan Ermilov.Nm 158a5b912ffSGlen Barber.Op Fl R Ar rootdir 1595f12594aSDavid Nugent.Op Fl V Ar etcdir 160d6f907dcSJoerg Wunsch.Ar groupshow 161*1e4d5cf1SDevin Teske.Oo Fl n Oc name|gid | Fl g Ar gid 162d6f907dcSJoerg Wunsch.Op Fl F 1639fd0dafcSJoerg Wunsch.Op Fl P 164d6f907dcSJoerg Wunsch.Op Fl a 165e97407b4SRuslan Ermilov.Nm 166a5b912ffSGlen Barber.Op Fl R Ar rootdir 1675f12594aSDavid Nugent.Op Fl V Ar etcdir 1689fd0dafcSJoerg Wunsch.Ar groupnext 1699fd0dafcSJoerg Wunsch.Op Fl C Ar config 1703bfc59e8SBaptiste Daroussin.Op Fl q 171e468afb4SDima Dorfman.Nm 172a5b912ffSGlen Barber.Op Fl R Ar rootdir 173e468afb4SDima Dorfman.Op Fl V Ar etcdir 174e468afb4SDima Dorfman.Ar lock 175*1e4d5cf1SDevin Teske.Oo Fl n Oc name|uid | Fl u Ar uid 176e468afb4SDima Dorfman.Op Fl C Ar config 177e468afb4SDima Dorfman.Op Fl q 178e468afb4SDima Dorfman.Nm 179a5b912ffSGlen Barber.Op Fl R Ar rootdir 180e468afb4SDima Dorfman.Op Fl V Ar etcdir 181e468afb4SDima Dorfman.Ar unlock 182*1e4d5cf1SDevin Teske.Oo Fl n Oc name|uid | Fl u Ar uid 183e468afb4SDima Dorfman.Op Fl C Ar config 184e468afb4SDima Dorfman.Op Fl q 185d6f907dcSJoerg Wunsch.Sh DESCRIPTION 186490d5836SPhilippe CharnierThe 187490d5836SPhilippe Charnier.Nm 188490d5836SPhilippe Charnierutility is a command-line based editor for the system 1891dcc6ec7SPhilippe Charnier.Ar user 190d6f907dcSJoerg Wunschand 1911dcc6ec7SPhilippe Charnier.Ar group 1923a7e7077SDaniel O'Callaghanfiles, allowing the superuser an easy to use and standardized way of adding, 193d6f907dcSJoerg Wunschmodifying and removing users and groups. 194d6f907dcSJoerg WunschNote that 1951dcc6ec7SPhilippe Charnier.Nm 196490d5836SPhilippe Charnieronly operates on the local user and group files. 197490d5836SPhilippe Charnier.Tn NIS 198490d5836SPhilippe Charnierusers and groups must be 199490d5836SPhilippe Charniermaintained on the 200490d5836SPhilippe Charnier.Tn NIS 201490d5836SPhilippe Charnierserver. 202490d5836SPhilippe CharnierThe 203490d5836SPhilippe Charnier.Nm 204490d5836SPhilippe Charnierutility handles updating the 205053375e8SMike Pritchard.Pa passwd , 206053375e8SMike Pritchard.Pa master.passwd , 207053375e8SMike Pritchard.Pa group 208053375e8SMike Pritchardand the secure and insecure 209d6f907dcSJoerg Wunschpassword database files, and must be run as root. 210d6f907dcSJoerg Wunsch.Pp 211137db389SSteve PriceThe first one or two keywords provided to 212137db389SSteve Price.Nm 213137db389SSteve Priceon the command line provide the context for the remainder of the arguments. 214137db389SSteve PriceThe keywords 215d6f907dcSJoerg Wunsch.Ar user 216d6f907dcSJoerg Wunschand 217d6f907dcSJoerg Wunsch.Ar group 218137db389SSteve Pricemay be combined with 219d6f907dcSJoerg Wunsch.Ar add , 220d6f907dcSJoerg Wunsch.Ar del , 2219fd0dafcSJoerg Wunsch.Ar mod , 222d6f907dcSJoerg Wunsch.Ar show , 2239fd0dafcSJoerg Wunschor 224137db389SSteve Price.Ar next 2254e86fcacSSheldon Hearnin any order. 2264e86fcacSSheldon Hearn(For example, 227137db389SSteve Price.Ar showuser , 228137db389SSteve Price.Ar usershow , 229610a5778SRuslan Ermilov.Ar show user , 230610a5778SRuslan Ermilovand 231137db389SSteve Price.Ar user show 232137db389SSteve Priceall mean the same thing.) 233137db389SSteve PriceThis flexibility is useful for interactive scripts calling 2341dcc6ec7SPhilippe Charnier.Nm 235137db389SSteve Pricefor user and group database manipulation. 236*1e4d5cf1SDevin TeskeFollowing these keywords, 237*1e4d5cf1SDevin Teskethe user or group name or numeric id may be optionally specified as an 238*1e4d5cf1SDevin Teskealternative to using the 239d6f907dcSJoerg Wunsch.Fl n Ar name , 240d6f907dcSJoerg Wunsch.Fl u Ar uid , 241d6f907dcSJoerg Wunsch.Fl g Ar gid 2429fd0dafcSJoerg Wunschoptions. 243d6f907dcSJoerg Wunsch.Pp 244d5a3b1edSDima DorfmanThe following flags are common to most or all modes of operation: 2459fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 246a5b912ffSGlen Barber.It Fl R Ar rootdir 247a5b912ffSGlen BarberSpecifies an alternate root directory within which 248a5b912ffSGlen Barber.Nm 249a5b912ffSGlen Barberwill operate. 250a5b912ffSGlen BarberAny paths specified will be relative to 251a5b912ffSGlen Barber.Va rootdir . 2525f12594aSDavid Nugent.It Fl V Ar etcdir 253*1e4d5cf1SDevin TeskeSet an alternate location for the password, group, and configuration files. 254*1e4d5cf1SDevin TeskeCan be used to maintain a user/group database in an alternate location. 2555f12594aSDavid NugentIf this switch is specified, the system 2565f12594aSDavid Nugent.Pa /etc/pw.conf 257*1e4d5cf1SDevin Teskewill not be sourced for default configuration data, 258*1e4d5cf1SDevin Teskebut the file pw.conf in the specified directory will be used instead 259*1e4d5cf1SDevin Teske.Pq or none, if it does not exist . 2605f12594aSDavid NugentThe 2615f12594aSDavid Nugent.Fl C 2625f12594aSDavid Nugentflag may be used to override this behaviour. 2635f12594aSDavid NugentAs an exception to the general rule where options must follow the operation 2645f12594aSDavid Nugenttype, the 2655f12594aSDavid Nugent.Fl V 2664369c82dSBaptiste Daroussinflag must be used on the command line before the operation keyword. 267d6f907dcSJoerg Wunsch.It Fl C Ar config 268d6f907dcSJoerg WunschBy default, 2691dcc6ec7SPhilippe Charnier.Nm 270d6f907dcSJoerg Wunschreads the file 271d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 272137db389SSteve Priceto obtain policy information on how new user accounts and groups are to be created. 273137db389SSteve PriceThe 2749fd0dafcSJoerg Wunsch.Fl C 2759fd0dafcSJoerg Wunschoption specifies a different configuration file. 276137db389SSteve PriceWhile most of the contents of the configuration file may be overridden via 277137db389SSteve Pricecommand-line options, it may be more convenient to keep standard information in a 278137db389SSteve Priceconfiguration file. 279d6f907dcSJoerg Wunsch.It Fl q 280d6f907dcSJoerg WunschUse of this option causes 2811dcc6ec7SPhilippe Charnier.Nm 282*1e4d5cf1SDevin Tesketo suppress error messages, 283*1e4d5cf1SDevin Teskewhich may be useful in interactive environments where it 284d6f907dcSJoerg Wunschis preferable to interpret status codes returned by 2851dcc6ec7SPhilippe Charnier.Nm 286d6f907dcSJoerg Wunschrather than messing up a carefully formatted display. 2879fd0dafcSJoerg Wunsch.It Fl N 288137db389SSteve PriceThis option is available in 289137db389SSteve Price.Ar add 290137db389SSteve Priceand 291137db389SSteve Price.Ar modify 292137db389SSteve Priceoperations, and tells 2931dcc6ec7SPhilippe Charnier.Nm 294137db389SSteve Priceto output the result of the operation without updating the user or group 295137db389SSteve Pricedatabases. 2969fd0dafcSJoerg WunschYou may use the 2979fd0dafcSJoerg Wunsch.Fl P 2989fd0dafcSJoerg Wunschoption to switch between standard passwd and readable formats. 299f1d684faSDavid Nugent.It Fl Y 300f1d684faSDavid NugentUsing this option with any of the update modes causes 3011dcc6ec7SPhilippe Charnier.Nm 302f1d684faSDavid Nugentto run 303f1d684faSDavid Nugent.Xr make 1 304f1d684faSDavid Nugentafter changing to the directory 305f1d684faSDavid Nugent.Pa /var/yp . 306490d5836SPhilippe CharnierThis is intended to allow automatic updating of 307490d5836SPhilippe Charnier.Tn NIS 308490d5836SPhilippe Charnierdatabase files. 309490d5836SPhilippe CharnierIf separate passwd and group files are being used by 310490d5836SPhilippe Charnier.Tn NIS , 311490d5836SPhilippe Charnierthen use the 312f1d684faSDavid Nugent.Fl y Ar path 313490d5836SPhilippe Charnieroption to specify the location of the 314490d5836SPhilippe Charnier.Tn NIS 315490d5836SPhilippe Charnierpasswd database so that 316137db389SSteve Price.Nm 317137db389SSteve Pricewill concurrently update it with the system password 318f1d684faSDavid Nugentdatabases. 319d6f907dcSJoerg Wunsch.El 320d6f907dcSJoerg Wunsch.Sh USER OPTIONS 321d6f907dcSJoerg WunschThe following options apply to the 322137db389SSteve Price.Ar useradd 323d6f907dcSJoerg Wunschand 324137db389SSteve Price.Ar usermod 325d6f907dcSJoerg Wunschcommands: 3269fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 327*1e4d5cf1SDevin Teske.It Oo Fl n Oc Ar name 328*1e4d5cf1SDevin TeskeRequired unless 329*1e4d5cf1SDevin Teske.Fl u Ar uid 330*1e4d5cf1SDevin Teskeis given. 3311dcc6ec7SPhilippe CharnierSpecify the user/account name. 332*1e4d5cf1SDevin TeskeIn the case of 333*1e4d5cf1SDevin Teske.Ar usermod 334*1e4d5cf1SDevin Teskecan be a uid. 335d6f907dcSJoerg Wunsch.It Fl u Ar uid 336*1e4d5cf1SDevin TeskeRequired if 337*1e4d5cf1SDevin Teske.Ar name 338*1e4d5cf1SDevin Teskeis not given. 3391dcc6ec7SPhilippe CharnierSpecify the user/account numeric id. 340*1e4d5cf1SDevin TeskeIn the case of 341*1e4d5cf1SDevin Teske.Ar usermod 342*1e4d5cf1SDevin Teskeif paired with 343*1e4d5cf1SDevin Teske.Ar name , 344*1e4d5cf1SDevin Teskechanges the numeric id of the named user/account. 345d6f907dcSJoerg Wunsch.Pp 346*1e4d5cf1SDevin TeskeUsually, only one of these options is required, 347*1e4d5cf1SDevin Teskeas the account name will imply the uid, or vice versa. 348*1e4d5cf1SDevin TeskeHowever, there are times when both are needed. 349d6f907dcSJoerg WunschFor example, when changing the uid of an existing user with 350d6f907dcSJoerg Wunsch.Ar usermod , 351*1e4d5cf1SDevin Teskeor overriding the default uid when creating a new account with 352*1e4d5cf1SDevin Teske.Ar useradd . 353*1e4d5cf1SDevin TeskeTo automatically allocate the uid to a new user with 354d6f907dcSJoerg Wunsch.Ar useradd , 355*1e4d5cf1SDevin Teskethen do 356d6f907dcSJoerg Wunsch.Em not 357d6f907dcSJoerg Wunschuse the 35808657612SRuslan Ermilov.Fl u 3599fd0dafcSJoerg Wunschoption. 360*1e4d5cf1SDevin TeskeEither the account or userid can also be provided immediately after the 361137db389SSteve Price.Ar useradd , 362137db389SSteve Price.Ar userdel , 363137db389SSteve Price.Ar usermod 364137db389SSteve Priceor 365137db389SSteve Price.Ar usershow 366137db389SSteve Pricekeywords on the command line without using the 36708657612SRuslan Ermilov.Fl n 368137db389SSteve Priceor 36908657612SRuslan Ermilov.Fl u 370137db389SSteve Priceoptions. 371d6f907dcSJoerg Wunsch.El 372d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist" 373d6f907dcSJoerg Wunsch.It Fl c Ar comment 374*1e4d5cf1SDevin TeskeThis field sets the contents of the passwd GECOS field, 375*1e4d5cf1SDevin Teskewhich normally contains up to four comma-separated fields containing the 376*1e4d5cf1SDevin Teskeuser's full name, office or location, 377137db389SSteve Priceand work and home phone numbers. 378d6f907dcSJoerg WunschThese sub-fields are used by convention only, however, and are optional. 379*1e4d5cf1SDevin TeskeIf this field is to contain spaces, 380*1e4d5cf1SDevin Teskethe comment must be enclosed in double quotes 381d6f907dcSJoerg Wunsch.Ql \&" . 382*1e4d5cf1SDevin TeskeAvoid using commas in this field as these are used as sub-field separators, 383*1e4d5cf1SDevin Teskeand the colon 384d6f907dcSJoerg Wunsch.Ql \&: 385137db389SSteve Pricecharacter also cannot be used as this is the field separator for the passwd 386137db389SSteve Pricefile itself. 387d6f907dcSJoerg Wunsch.It Fl d Ar dir 388d6f907dcSJoerg WunschThis option sets the account's home directory. 389*1e4d5cf1SDevin TeskeNormally, 390*1e4d5cf1SDevin Teskethis is only used if the home directory is to be different from the 391137db389SSteve Pricedefault determined from 392137db389SSteve Price.Pa /etc/pw.conf 3931dcc6ec7SPhilippe Charnier- normally 3941dcc6ec7SPhilippe Charnier.Pa /home 395137db389SSteve Pricewith the account name as a subdirectory. 396d6f907dcSJoerg Wunsch.It Fl e Ar date 3971dcc6ec7SPhilippe CharnierSet the account's expiration date. 398d6f907dcSJoerg WunschFormat of the date is either a UNIX time in decimal, or a date in 399137db389SSteve Price.Ql dd-mmm-yy[yy] 400*1e4d5cf1SDevin Teskeformat, where dd is the day, 401*1e4d5cf1SDevin Teskemmm is the month, either in numeric or alphabetic format 4021dcc6ec7SPhilippe Charnier('Jan', 'Feb', etc) and year is either a two or four digit year. 403d6f907dcSJoerg WunschThis option also accepts a relative date in the form 404d6f907dcSJoerg Wunsch.Ql \&+n[mhdwoy] 405d6f907dcSJoerg Wunschwhere 406d6f907dcSJoerg Wunsch.Ql \&n 407*1e4d5cf1SDevin Teskeis a decimal, 408*1e4d5cf1SDevin Teskeoctal (leading 0) or hexadecimal (leading 0x) digit followed by the 409053375e8SMike Pritchardnumber of Minutes, Hours, Days, Weeks, Months or Years from the current date at 410137db389SSteve Pricewhich the expiration date is to be set. 411d6f907dcSJoerg Wunsch.It Fl p Ar date 4121dcc6ec7SPhilippe CharnierSet the account's password expiration date. 413137db389SSteve PriceThis field is similar to the account expiration date option, except that it 414d6f907dcSJoerg Wunschapplies to forced password changes. 415137db389SSteve PriceThis is set in the same manner as the 41608657612SRuslan Ermilov.Fl e 417137db389SSteve Priceoption. 418d6f907dcSJoerg Wunsch.It Fl g Ar group 4191dcc6ec7SPhilippe CharnierSet the account's primary group to the given group. 420d6f907dcSJoerg Wunsch.Ar group 421137db389SSteve Pricemay be defined by either its name or group number. 422d6f907dcSJoerg Wunsch.It Fl G Ar grouplist 423490d5836SPhilippe CharnierSet additional group memberships for an account. 424d6f907dcSJoerg Wunsch.Ar grouplist 42540ab104eSMike Makonnenis a comma, space or tab-separated list of group names or group numbers. 426137db389SSteve PriceThe user's name is added to the group lists in 427d6f907dcSJoerg Wunsch.Pa /etc/group , 428137db389SSteve Priceand 429d6f907dcSJoerg Wunschremoved from any groups not specified in 430d6f907dcSJoerg Wunsch.Ar grouplist . 431137db389SSteve PriceNote: a user should not be added to their primary group with 432137db389SSteve Price.Ar grouplist . 433137db389SSteve PriceAlso, group membership changes do not take effect for current user login 434137db389SSteve Pricesessions, requiring the user to reconnect to be affected by the changes. 4359fd0dafcSJoerg Wunsch.It Fl L Ar class 4369fd0dafcSJoerg WunschThis option sets the login class for the user being created. 4379fd0dafcSJoerg WunschSee 4389fd0dafcSJoerg Wunsch.Xr login.conf 5 43916b4ad52SGiorgos Keramidasand 44016b4ad52SGiorgos Keramidas.Xr passwd 5 441137db389SSteve Pricefor more information on user login classes. 442d6f907dcSJoerg Wunsch.It Fl m 443d6f907dcSJoerg WunschThis option instructs 4441dcc6ec7SPhilippe Charnier.Nm 445d6f907dcSJoerg Wunschto attempt to create the user's home directory. 446d6f907dcSJoerg WunschWhile primarily useful when adding a new account with 447d6f907dcSJoerg Wunsch.Ar useradd , 448*1e4d5cf1SDevin Teskethis may also be of use when moving an existing user's home directory elsewhere 449*1e4d5cf1SDevin Teskeon the file system. 450d6f907dcSJoerg WunschThe new home directory is populated with the contents of the 451d6f907dcSJoerg Wunsch.Ar skeleton 452d6f907dcSJoerg Wunschdirectory, which typically contains a set of shell configuration files that the 453053375e8SMike Pritcharduser may personalize to taste. 45431e224ddSTom RhodesFiles in this directory are usually named 455fd59f59aSTom Rhodes.Pa dot . Ns Aq Ar config 45631e224ddSTom Rhodeswhere the 457fd59f59aSTom Rhodes.Pa dot 45831e224ddSTom Rhodesprefix will be stripped. 459d6f907dcSJoerg WunschWhen 46008657612SRuslan Ermilov.Fl m 461d6f907dcSJoerg Wunschis used on an account with 462d6f907dcSJoerg Wunsch.Ar usermod , 463137db389SSteve Priceexisting configuration files in the user's home directory are 464d6f907dcSJoerg Wunsch.Em not 465137db389SSteve Priceoverwritten from the skeleton files. 466d6f907dcSJoerg Wunsch.Pp 467*1e4d5cf1SDevin TeskeWhen a user's home directory is created, 468*1e4d5cf1SDevin Teskeit will by default be a subdirectory of the 469d6f907dcSJoerg Wunsch.Ar basehome 470137db389SSteve Pricedirectory as specified by the 47108657612SRuslan Ermilov.Fl b 472137db389SSteve Priceoption (see below), bearing the name of the new account. 473137db389SSteve PriceThis can be overridden by the 47408657612SRuslan Ermilov.Fl d 475d6f907dcSJoerg Wunschoption on the command line, if desired. 476eebbeceeSLukas Ertl.It Fl M Ar mode 477eebbeceeSLukas ErtlCreate the user's home directory with the specified 47885204142SLukas Ertl.Ar mode , 47985204142SLukas Ertlmodified by the current 48085204142SLukas Ertl.Xr umask 2 . 481eebbeceeSLukas ErtlIf omitted, it is derived from the parent process' 482eebbeceeSLukas Ertl.Xr umask 2 . 483eebbeceeSLukas ErtlThis option is only useful in combination with the 484eebbeceeSLukas Ertl.Fl m 485eebbeceeSLukas Ertlflag. 486d6f907dcSJoerg Wunsch.It Fl k Ar dir 4871dcc6ec7SPhilippe CharnierSet the 488d6f907dcSJoerg Wunsch.Ar skeleton 489137db389SSteve Pricedirectory, from which basic startup and configuration files are copied when 490d6f907dcSJoerg Wunschthe user's home directory is created. 491137db389SSteve PriceThis option only has meaning when used with the 49208657612SRuslan Ermilov.Fl d 493137db389SSteve Priceor 49408657612SRuslan Ermilov.Fl m 495137db389SSteve Priceflags. 496d6f907dcSJoerg Wunsch.It Fl s Ar shell 4971dcc6ec7SPhilippe CharnierSet or changes the user's login shell to 498d6f907dcSJoerg Wunsch.Ar shell . 499d6f907dcSJoerg WunschIf the path to the shell program is omitted, 5001dcc6ec7SPhilippe Charnier.Nm 501d6f907dcSJoerg Wunschsearches the 502d6f907dcSJoerg Wunsch.Ar shellpath 503d6f907dcSJoerg Wunschspecified in 504d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 505d6f907dcSJoerg Wunschand fills it in as appropriate. 506d6f907dcSJoerg WunschNote that unless you have a specific reason to do so, you should avoid 507d6f907dcSJoerg Wunschspecifying the path - this will allow 5081dcc6ec7SPhilippe Charnier.Nm 509d6f907dcSJoerg Wunschto validate that the program exists and is executable. 510d6f907dcSJoerg WunschSpecifying a full path (or supplying a blank "" shell) avoids this check 511d6f907dcSJoerg Wunschand allows for such entries as 5121dcc6ec7SPhilippe Charnier.Pa /nonexistent 513d6f907dcSJoerg Wunschthat should be set for accounts not intended for interactive login. 514d6f907dcSJoerg Wunsch.It Fl h Ar fd 515d6f907dcSJoerg WunschThis option provides a special interface by which interactive scripts can 516d6f907dcSJoerg Wunschset an account password using 517e97407b4SRuslan Ermilov.Nm . 518137db389SSteve PriceBecause the command line and environment are fundamentally insecure mechanisms 519d6f907dcSJoerg Wunschby which programs can accept information, 5201dcc6ec7SPhilippe Charnier.Nm 521d6f907dcSJoerg Wunschwill only allow setting of account and group passwords via a file descriptor 522d6f907dcSJoerg Wunsch(usually a pipe between an interactive script and the program). 523d6f907dcSJoerg Wunsch.Ar sh , 524d6f907dcSJoerg Wunsch.Ar bash , 525d6f907dcSJoerg Wunsch.Ar ksh 526d6f907dcSJoerg Wunschand 527d6f907dcSJoerg Wunsch.Ar perl 528137db389SSteve Priceall possess mechanisms by which this can be done. 529d6f907dcSJoerg WunschAlternatively, 530325970a9SPhilippe Charnier.Nm 531d6f907dcSJoerg Wunschwill prompt for the user's password if 53208657612SRuslan Ermilov.Fl h Ar 0 533d6f907dcSJoerg Wunschis given, nominating 534d6f907dcSJoerg Wunsch.Em stdin 535d6f907dcSJoerg Wunschas the file descriptor on which to read the password. 536137db389SSteve PriceNote that this password will be read only once and is intended 537137db389SSteve Pricefor use by a script rather than for interactive use. 538d6f907dcSJoerg WunschIf you wish to have new password confirmation along the lines of 539d6f907dcSJoerg Wunsch.Xr passwd 1 , 540137db389SSteve Pricethis must be implemented as part of an interactive script that calls 541e97407b4SRuslan Ermilov.Nm . 542d6f907dcSJoerg Wunsch.Pp 543d6f907dcSJoerg WunschIf a value of 544d6f907dcSJoerg Wunsch.Ql \&- 545d6f907dcSJoerg Wunschis given as the argument 546d6f907dcSJoerg Wunsch.Ar fd , 547d6f907dcSJoerg Wunschthen the password will be set to 548d6f907dcSJoerg Wunsch.Ql \&* , 549137db389SSteve Pricerendering the account inaccessible via password-based login. 55087d6b5caSIan Dowse.It Fl H Ar fd 55187d6b5caSIan DowseRead an encrypted password string from the specified file descriptor. 55287d6b5caSIan DowseThis is like 55387d6b5caSIan Dowse.Fl h , 55487d6b5caSIan Dowsebut the password should be supplied already encrypted in a form 55587d6b5caSIan Dowsesuitable for writing directly to the password database. 556d6f907dcSJoerg Wunsch.El 557d6f907dcSJoerg Wunsch.Pp 558d6f907dcSJoerg WunschIt is possible to use 559d6f907dcSJoerg Wunsch.Ar useradd 560d6f907dcSJoerg Wunschto create a new account that duplicates an existing user id. 561d6f907dcSJoerg WunschWhile this is normally considered an error and will be rejected, the 56208657612SRuslan Ermilov.Fl o 5639fd0dafcSJoerg Wunschoption overrides the check for duplicates and allows the duplication of 5649fd0dafcSJoerg Wunschthe user id. 5659fd0dafcSJoerg WunschThis may be useful if you allow the same user to login under 5669fd0dafcSJoerg Wunschdifferent contexts (different group allocations, different home 5679fd0dafcSJoerg Wunschdirectory, different shell) while providing basically the same 5689fd0dafcSJoerg Wunschpermissions for access to the user's files in each account. 569d6f907dcSJoerg Wunsch.Pp 570d6f907dcSJoerg WunschThe 571d6f907dcSJoerg Wunsch.Ar useradd 572d6f907dcSJoerg Wunschcommand also has the ability to set new user and group defaults by using the 57308657612SRuslan Ermilov.Fl D 5749fd0dafcSJoerg Wunschoption. 575d6f907dcSJoerg WunschInstead of adding a new user, 5761dcc6ec7SPhilippe Charnier.Nm 577d6f907dcSJoerg Wunschwrites a new set of defaults to its configuration file, 578d6f907dcSJoerg Wunsch.Pa /etc/pw.conf . 579d6f907dcSJoerg WunschWhen using the 58008657612SRuslan Ermilov.Fl D 5819fd0dafcSJoerg Wunschoption, you must not use either 58208657612SRuslan Ermilov.Fl n Ar name 583d6f907dcSJoerg Wunschor 58408657612SRuslan Ermilov.Fl u Ar uid 585d6f907dcSJoerg Wunschor an error will result. 586d6f907dcSJoerg WunschUse of 58708657612SRuslan Ermilov.Fl D 5889fd0dafcSJoerg Wunschchanges the meaning of several command line switches in the 589d6f907dcSJoerg Wunsch.Ar useradd 590d6f907dcSJoerg Wunschcommand. 591d6f907dcSJoerg WunschThese are: 592d6f907dcSJoerg Wunsch.Bl -tag -width "-G grouplist" 593d6f907dcSJoerg Wunsch.It Fl D 594d6f907dcSJoerg WunschSet default values in 595d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 596d6f907dcSJoerg Wunschconfiguration file, or a different named configuration file if the 59708657612SRuslan Ermilov.Fl C Ar config 5989fd0dafcSJoerg Wunschoption is used. 599d6f907dcSJoerg Wunsch.It Fl b Ar dir 6001dcc6ec7SPhilippe CharnierSet the root directory in which user home directories are created. 601d6f907dcSJoerg WunschThe default value for this is 6021dcc6ec7SPhilippe Charnier.Pa /home , 603d6f907dcSJoerg Wunschbut it may be set elsewhere as desired. 604d6f907dcSJoerg Wunsch.It Fl e Ar days 6051dcc6ec7SPhilippe CharnierSet the default account expiration period in days. 606*1e4d5cf1SDevin TeskeWhen 607*1e4d5cf1SDevin Teske.Fl D 608*1e4d5cf1SDevin Teskeis used, the 609*1e4d5cf1SDevin Teske.Ar days 610*1e4d5cf1SDevin Teskeargument is interpreted differently. 611*1e4d5cf1SDevin TeskeIt must be numeric and represents the number of days after creation 612*1e4d5cf1SDevin Teskethat the account expires. 613d6f907dcSJoerg WunschA value of 0 suppresses automatic calculation of the expiry date. 614d6f907dcSJoerg Wunsch.It Fl p Ar days 6151dcc6ec7SPhilippe CharnierSet the default password expiration period in days. 616d6f907dcSJoerg Wunsch.It Fl g Ar group 6171dcc6ec7SPhilippe CharnierSet the default group for new users. 618d6f907dcSJoerg WunschIf a blank group is specified using 61908657612SRuslan Ermilov.Fl g Ar \&"" , 620137db389SSteve Pricethen new users will be allocated their own private primary group 621137db389SSteve Pricewith the same name as their login name. 622d6f907dcSJoerg WunschIf a group is supplied, either its name or uid may be given as an argument. 623d6f907dcSJoerg Wunsch.It Fl G Ar grouplist 624137db389SSteve PriceSet the default groups in which new users are granted membership. 625*1e4d5cf1SDevin TeskeThis is a separate set of groups from the primary group. 626*1e4d5cf1SDevin TeskeAvoid nominating the same group as both primary and extra groups. 627d6f907dcSJoerg WunschIn other words, these extra groups determine membership in groups 628d6f907dcSJoerg Wunsch.Em other than 629d6f907dcSJoerg Wunschthe primary group. 630d6f907dcSJoerg Wunsch.Ar grouplist 631137db389SSteve Priceis a comma-separated list of group names or ids, and are always 632d6f907dcSJoerg Wunschstored in 633d6f907dcSJoerg Wunsch.Pa /etc/pw.conf 634d6f907dcSJoerg Wunschby their symbolic names. 6359fd0dafcSJoerg Wunsch.It Fl L Ar class 6369fd0dafcSJoerg WunschThis option sets the default login class for new users. 637d6f907dcSJoerg Wunsch.It Fl k Ar dir 6381dcc6ec7SPhilippe CharnierSet the default 639d6f907dcSJoerg Wunsch.Em skeleton 640*1e4d5cf1SDevin Teskedirectory, 641*1e4d5cf1SDevin Teskefrom which prototype shell and other initialization files are copied when 6421dcc6ec7SPhilippe Charnier.Nm 643d6f907dcSJoerg Wunschcreates a user's home directory. 64431e224ddSTom RhodesSee description of 64531e224ddSTom Rhodes.Fl k 64631e224ddSTom Rhodesfor naming conventions of these files. 647610a5778SRuslan Ermilov.It Xo 648610a5778SRuslan Ermilov.Fl u Ar min , Ns Ar max , 649610a5778SRuslan Ermilov.Fl i Ar min , Ns Ar max 650610a5778SRuslan Ermilov.Xc 651*1e4d5cf1SDevin TeskeSet the minimum and maximum user and group ids allocated for new 652*1e4d5cf1SDevin Teskeaccounts and groups created by 653e97407b4SRuslan Ermilov.Nm . 654d6f907dcSJoerg WunschThe default values for each is 1000 minimum and 32000 maximum. 655d6f907dcSJoerg Wunsch.Ar min 656d6f907dcSJoerg Wunschand 657d6f907dcSJoerg Wunsch.Ar max 658*1e4d5cf1SDevin Teskeare both numbers, where max must be greater than min, 659*1e4d5cf1SDevin Teskeand both must be between 0 and 32767. 660*1e4d5cf1SDevin TeskeIn general, 661*1e4d5cf1SDevin Teskeuser and group ids less than 100 are reserved for use by the system, 662*1e4d5cf1SDevin Teskeand numbers greater than 32000 may also be reserved for special purposes 663*1e4d5cf1SDevin Teske.Pq used by some system daemons . 664d6f907dcSJoerg Wunsch.It Fl w Ar method 665d6f907dcSJoerg WunschThe 66608657612SRuslan Ermilov.Fl w 667*1e4d5cf1SDevin Teskeoption selects the default method used to set passwords for newly created user 668*1e4d5cf1SDevin Teskeaccounts. 669d6f907dcSJoerg Wunsch.Ar method 670d6f907dcSJoerg Wunschis one of: 671d6f907dcSJoerg Wunsch.Pp 672d6f907dcSJoerg Wunsch.Bl -tag -width random -offset indent -compact 673d6f907dcSJoerg Wunsch.It no 6741dcc6ec7SPhilippe Charnierdisable login on newly created accounts 675d6f907dcSJoerg Wunsch.It yes 6761dcc6ec7SPhilippe Charnierforce the password to be the account name 677d6f907dcSJoerg Wunsch.It none 6781dcc6ec7SPhilippe Charnierforce a blank password 679d6f907dcSJoerg Wunsch.It random 6801dcc6ec7SPhilippe Charniergenerate a random password 681d6f907dcSJoerg Wunsch.El 682d6f907dcSJoerg Wunsch.Pp 683d6f907dcSJoerg WunschThe 684d6f907dcSJoerg Wunsch.Ql \&random 685d6f907dcSJoerg Wunschor 686d6f907dcSJoerg Wunsch.Ql \&no 687d6f907dcSJoerg Wunschmethods are the most secure; in the former case, 6881dcc6ec7SPhilippe Charnier.Nm 689*1e4d5cf1SDevin Teskegenerates a password and prints it to stdout, 690*1e4d5cf1SDevin Teskewhich is suitable when users are issued passwords rather than being allowed 691*1e4d5cf1SDevin Tesketo select their own 692*1e4d5cf1SDevin Teske.Pq possibly poorly chosen 693*1e4d5cf1SDevin Teskepassword. 694d6f907dcSJoerg WunschThe 695d6f907dcSJoerg Wunsch.Ql \&no 696d6f907dcSJoerg Wunschmethod requires that the superuser use 697d6f907dcSJoerg Wunsch.Xr passwd 1 698d6f907dcSJoerg Wunschto render the account accessible with a password. 699f1d684faSDavid Nugent.It Fl y Ar path 700490d5836SPhilippe CharnierThis sets the pathname of the database used by 701490d5836SPhilippe Charnier.Tn NIS 702490d5836SPhilippe Charnierif you are not sharing 703f1d684faSDavid Nugentthe information from 704f1d684faSDavid Nugent.Pa /etc/master.passwd 705490d5836SPhilippe Charnierdirectly with 706490d5836SPhilippe Charnier.Tn NIS . 707490d5836SPhilippe CharnierYou should only set this option for 708490d5836SPhilippe Charnier.Tn NIS 709490d5836SPhilippe Charnierservers. 710d6f907dcSJoerg Wunsch.El 711d6f907dcSJoerg Wunsch.Pp 712d6f907dcSJoerg WunschThe 713d6f907dcSJoerg Wunsch.Ar userdel 714*1e4d5cf1SDevin Teskecommand has three distinct options. 715f2e366a1SSheldon HearnThe 71608657612SRuslan Ermilov.Fl n Ar name 717d6f907dcSJoerg Wunschand 71808657612SRuslan Ermilov.Fl u Ar uid 7199fd0dafcSJoerg Wunschoptions have already been covered above. 7209fd0dafcSJoerg WunschThe additional option is: 7219fd0dafcSJoerg Wunsch.Bl -tag -width "-G grouplist" 722d6f907dcSJoerg Wunsch.It Fl r 723d6f907dcSJoerg WunschThis tells 7241dcc6ec7SPhilippe Charnier.Nm 725d6f907dcSJoerg Wunschto remove the user's home directory and all of its contents. 726490d5836SPhilippe CharnierThe 727490d5836SPhilippe Charnier.Nm 728490d5836SPhilippe Charnierutility errs on the side of caution when removing files from the system. 729*1e4d5cf1SDevin TeskeFirstly, 730*1e4d5cf1SDevin Teskeit will not do so if the uid of the account being removed is also used by 731d6f907dcSJoerg Wunschanother account on the system, and the 'home' directory in the password file is 732d6f907dcSJoerg Wunscha valid path that commences with the character 733d6f907dcSJoerg Wunsch.Ql \&/ . 734d6f907dcSJoerg WunschSecondly, it will only remove files and directories that are actually owned by 735d6f907dcSJoerg Wunschthe user, or symbolic links owned by anyone under the user's home directory. 736d6f907dcSJoerg WunschFinally, after deleting all contents owned by the user only empty directories 737d6f907dcSJoerg Wunschwill be removed. 738053375e8SMike PritchardIf any additional cleanup work is required, this is left to the administrator. 739d6f907dcSJoerg Wunsch.El 740d6f907dcSJoerg Wunsch.Pp 741*1e4d5cf1SDevin TeskeMail spool files and crontabs are always removed when an account is deleted as 742*1e4d5cf1SDevin Teskethese are unconditionally attached to the user name. 743d6f907dcSJoerg WunschJobs queued for processing by 744d6f907dcSJoerg Wunsch.Ar at 745*1e4d5cf1SDevin Teskeare also removed if the user's uid is unique and not also used by another 746*1e4d5cf1SDevin Teskeaccount on the system. 747d6f907dcSJoerg Wunsch.Pp 748d6f907dcSJoerg WunschThe 74919e1bf29SEitan Adler.Ar usermod 75019e1bf29SEitan Adlercommand adds one additional option: 75119e1bf29SEitan Adler.Bl -tag -width "-G grouplist" 752*1e4d5cf1SDevin Teske.It Fl l Ar newname 75319e1bf29SEitan AdlerThis option allows changing of an existing account name to 754*1e4d5cf1SDevin Teske.Ql \&newname . 75519e1bf29SEitan AdlerThe new name must not already exist, and any attempt to duplicate an 75619e1bf29SEitan Adlerexisting account name will be rejected. 75719e1bf29SEitan Adler.El 75819e1bf29SEitan Adler.Pp 75919e1bf29SEitan AdlerThe 760d6f907dcSJoerg Wunsch.Ar usershow 761d6f907dcSJoerg Wunschcommand allows viewing of an account in one of two formats. 762d6f907dcSJoerg WunschBy default, the format is identical to the format used in 763d6f907dcSJoerg Wunsch.Pa /etc/master.passwd 764d6f907dcSJoerg Wunschwith the password field replaced with a 765d6f907dcSJoerg Wunsch.Ql \&* . 766d6f907dcSJoerg WunschIf the 76708657612SRuslan Ermilov.Fl P 7689fd0dafcSJoerg Wunschoption is used, then 7691dcc6ec7SPhilippe Charnier.Nm 770d6f907dcSJoerg Wunschoutputs the account details in a more human readable form. 7714731d076SDima DorfmanIf the 7724731d076SDima Dorfman.Fl 7 7734731d076SDima Dorfmanoption is used, the account details are shown in v7 format. 774d6f907dcSJoerg WunschThe 77508657612SRuslan Ermilov.Fl a 7769fd0dafcSJoerg Wunschoption lists all users currently on file. 777466c257cSDima DorfmanUsing 778466c257cSDima Dorfman.Fl F 779466c257cSDima Dorfmanforces 780466c257cSDima Dorfman.Nm 781466c257cSDima Dorfmanto print the details of an account even if it does not exist. 7829fd0dafcSJoerg Wunsch.Pp 7839fd0dafcSJoerg WunschThe command 7849fd0dafcSJoerg Wunsch.Ar usernext 7859fd0dafcSJoerg Wunschreturns the next available user and group ids separated by a colon. 7869fd0dafcSJoerg WunschThis is normally of interest only to interactive scripts or front-ends 7879fd0dafcSJoerg Wunschthat use 788e97407b4SRuslan Ermilov.Nm . 789d6f907dcSJoerg Wunsch.Sh GROUP OPTIONS 790d6f907dcSJoerg WunschThe 79108657612SRuslan Ermilov.Fl C 792d6f907dcSJoerg Wunschand 79308657612SRuslan Ermilov.Fl q 7949fd0dafcSJoerg Wunschoptions (explained at the start of the previous section) are available 7959fd0dafcSJoerg Wunschwith the group manipulation commands. 796d6f907dcSJoerg WunschOther common options to all group-related commands are: 7979fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers" 798*1e4d5cf1SDevin Teske.It Oo Fl n Oc Ar name 799*1e4d5cf1SDevin TeskeRequired unless 800*1e4d5cf1SDevin Teske.Fl g Ar gid 801*1e4d5cf1SDevin Teskeis given. 8021dcc6ec7SPhilippe CharnierSpecify the group name. 803*1e4d5cf1SDevin TeskeIn the case of 804*1e4d5cf1SDevin Teske.Ar groupmod 805*1e4d5cf1SDevin Teskecan be a gid. 806d6f907dcSJoerg Wunsch.It Fl g Ar gid 807*1e4d5cf1SDevin TeskeRequired if 808*1e4d5cf1SDevin Teske.Ar name 809*1e4d5cf1SDevin Teskeis not given. 8101dcc6ec7SPhilippe CharnierSpecify the group numeric id. 811*1e4d5cf1SDevin TeskeIn the case of 812*1e4d5cf1SDevin Teske.Ar groupmod 813*1e4d5cf1SDevin Teskeif paired with 814*1e4d5cf1SDevin Teske.Ar name , 815*1e4d5cf1SDevin Teskechanges the numeric id of the named group. 816d6f907dcSJoerg Wunsch.Pp 8179fd0dafcSJoerg WunschAs with the account name and id fields, you will usually only need 8189fd0dafcSJoerg Wunschto supply one of these, as the group name implies the uid and vice 8199fd0dafcSJoerg Wunschversa. 8209fd0dafcSJoerg WunschYou will only need to use both when setting a specific group id 8219fd0dafcSJoerg Wunschagainst a new group or when changing the uid of an existing group. 8227ecd7a42SJoseph Koshy.It Fl M Ar memberlist 8239fd0dafcSJoerg WunschThis option provides an alternative way to add existing users to a 8249fd0dafcSJoerg Wunschnew group (in groupadd) or replace an existing membership list (in 8259fd0dafcSJoerg Wunschgroupmod). 8269fd0dafcSJoerg Wunsch.Ar memberlist 8279fd0dafcSJoerg Wunschis a comma separated list of valid and existing user names or uids. 8289fd0dafcSJoerg Wunsch.It Fl m Ar newmembers 8299fd0dafcSJoerg WunschSimilar to 83008657612SRuslan Ermilov.Fl M , 8319fd0dafcSJoerg Wunschthis option allows the 8329fd0dafcSJoerg Wunsch.Em addition 833137db389SSteve Priceof existing users to a group without replacing the existing list of 8349fd0dafcSJoerg Wunschmembers. 835137db389SSteve PriceLogin names or user ids may be used, and duplicate users are 836137db389SSteve Pricesilently eliminated. 837bc991a6dSSean Farley.It Fl d Ar oldmembers 838bc991a6dSSean FarleySimilar to 839bc991a6dSSean Farley.Fl M , 840bc991a6dSSean Farleythis option allows the 841bc991a6dSSean Farley.Em deletion 842bc991a6dSSean Farleyof existing users from a group without replacing the existing list of 843bc991a6dSSean Farleymembers. 844bc991a6dSSean FarleyLogin names or user ids may be used, and duplicate users are 845bc991a6dSSean Farleysilently eliminated. 846d6f907dcSJoerg Wunsch.El 847d6f907dcSJoerg Wunsch.Pp 848d6f907dcSJoerg Wunsch.Ar groupadd 849d6f907dcSJoerg Wunschalso has a 85008657612SRuslan Ermilov.Fl o 851137db389SSteve Priceoption that allows allocation of an existing group id to a new group. 852*1e4d5cf1SDevin TeskeThe default action is to reject an attempt to add a group, 853*1e4d5cf1SDevin Teskeand this option overrides the check for duplicate group ids. 854d6f907dcSJoerg WunschThere is rarely any need to duplicate a group id. 855d6f907dcSJoerg Wunsch.Pp 856d6f907dcSJoerg WunschThe 857d6f907dcSJoerg Wunsch.Ar groupmod 858137db389SSteve Pricecommand adds one additional option: 8599fd0dafcSJoerg Wunsch.Bl -tag -width "-m newmembers" 860*1e4d5cf1SDevin Teske.It Fl l Ar newname 861d6f907dcSJoerg WunschThis option allows changing of an existing group name to 862*1e4d5cf1SDevin Teske.Ql \&newname . 863*1e4d5cf1SDevin TeskeThe new name must not already exist, 864*1e4d5cf1SDevin Teskeand any attempt to duplicate an existing group 865d6f907dcSJoerg Wunschname will be rejected. 866d6f907dcSJoerg Wunsch.El 867d6f907dcSJoerg Wunsch.Pp 868d6f907dcSJoerg WunschOptions for 869d6f907dcSJoerg Wunsch.Ar groupshow 870d6f907dcSJoerg Wunschare the same as for 871d6f907dcSJoerg Wunsch.Ar usershow , 872d6f907dcSJoerg Wunschwith the 87308657612SRuslan Ermilov.Fl g Ar gid 874d6f907dcSJoerg Wunschreplacing 87508657612SRuslan Ermilov.Fl u Ar uid 876d6f907dcSJoerg Wunschto specify the group id. 8774731d076SDima DorfmanThe 8784731d076SDima Dorfman.Fl 7 8794731d076SDima Dorfmanoption does not apply to the 8804731d076SDima Dorfman.Ar groupshow 8814731d076SDima Dorfmancommand. 882d6f907dcSJoerg Wunsch.Pp 8839fd0dafcSJoerg WunschThe command 8849fd0dafcSJoerg Wunsch.Ar groupnext 8859fd0dafcSJoerg Wunschreturns the next available group id on standard output. 886e468afb4SDima Dorfman.Sh USER LOCKING 887490d5836SPhilippe CharnierThe 888490d5836SPhilippe Charnier.Nm 889490d5836SPhilippe Charnierutility 890e468afb4SDima Dorfmansupports a simple password locking mechanism for users; it works by 891e468afb4SDima Dorfmanprepending the string 892e468afb4SDima Dorfman.Ql *LOCKED* 893e468afb4SDima Dorfmanto the beginning of the password field in 894e468afb4SDima Dorfman.Pa master.passwd 895e468afb4SDima Dorfmanto prevent successful authentication. 896e468afb4SDima Dorfman.Pp 897e468afb4SDima DorfmanThe 898e468afb4SDima Dorfman.Ar lock 899e468afb4SDima Dorfmanand 900e468afb4SDima Dorfman.Ar unlock 901e468afb4SDima Dorfmancommands take a user name or uid of the account to lock or unlock, 90207bfccd7SRuslan Ermilovrespectively. 90307bfccd7SRuslan ErmilovThe 90408657612SRuslan Ermilov.Fl V , 90508657612SRuslan Ermilov.Fl C , 906e468afb4SDima Dorfmanand 90708657612SRuslan Ermilov.Fl q 908e468afb4SDima Dorfmanoptions as described above are accepted by these commands. 90959a3c79dSRuslan Ermilov.Sh NOTES 91059a3c79dSRuslan ErmilovFor a summary of options available with each command, you can use 91159a3c79dSRuslan Ermilov.Dl pw [command] help 91259a3c79dSRuslan ErmilovFor example, 91359a3c79dSRuslan Ermilov.Dl pw useradd help 91459a3c79dSRuslan Ermilovlists all available options for the useradd operation. 91559a3c79dSRuslan Ermilov.Pp 91659a3c79dSRuslan ErmilovThe 91759a3c79dSRuslan Ermilov.Nm 91859a3c79dSRuslan Ermilovutility allows 8-bit characters in the passwd GECOS field (user's full name, 91959a3c79dSRuslan Ermilovoffice, work and home phone number subfields), but disallows them in 92059a3c79dSRuslan Ermilovuser login and group names. 92159a3c79dSRuslan ErmilovUse 8-bit characters with caution, as connection to the Internet will 92259a3c79dSRuslan Ermilovrequire that your mail transport program supports 8BITMIME, and will 92359a3c79dSRuslan Ermilovconvert headers containing 8-bit characters to 7-bit quoted-printable 92459a3c79dSRuslan Ermilovformat. 92559a3c79dSRuslan Ermilov.Xr sendmail 8 92659a3c79dSRuslan Ermilovdoes support this. 92759a3c79dSRuslan ErmilovUse of 8-bit characters in the GECOS field should be used in 92859a3c79dSRuslan Ermilovconjunction with the user's default locale and character set 92959a3c79dSRuslan Ermilovand should not be implemented without their use. 93059a3c79dSRuslan ErmilovUsing 8-bit characters may also affect other 93159a3c79dSRuslan Ermilovprograms that transmit the contents of the GECOS field over the 93259a3c79dSRuslan ErmilovInternet, such as 93359a3c79dSRuslan Ermilov.Xr fingerd 8 , 93459a3c79dSRuslan Ermilovand a small number of TCP/IP clients, such as IRC, where full names 93559a3c79dSRuslan Ermilovspecified in the passwd file may be used by default. 93659a3c79dSRuslan Ermilov.Pp 93759a3c79dSRuslan ErmilovThe 93859a3c79dSRuslan Ermilov.Nm 93959a3c79dSRuslan Ermilovutility writes a log to the 94059a3c79dSRuslan Ermilov.Pa /var/log/userlog 94159a3c79dSRuslan Ermilovfile when actions such as user or group additions or deletions occur. 94259a3c79dSRuslan ErmilovThe location of this logfile can be changed in 94359a3c79dSRuslan Ermilov.Xr pw.conf 5 . 94459a3c79dSRuslan Ermilov.Sh FILES 94559a3c79dSRuslan Ermilov.Bl -tag -width /etc/master.passwd.new -compact 94659a3c79dSRuslan Ermilov.It Pa /etc/master.passwd 94759a3c79dSRuslan ErmilovThe user database 94859a3c79dSRuslan Ermilov.It Pa /etc/passwd 94959a3c79dSRuslan ErmilovA Version 7 format password file 95059a3c79dSRuslan Ermilov.It Pa /etc/login.conf 95159a3c79dSRuslan ErmilovThe user capabilities database 95259a3c79dSRuslan Ermilov.It Pa /etc/group 95359a3c79dSRuslan ErmilovThe group database 95459a3c79dSRuslan Ermilov.It Pa /etc/pw.conf 95559a3c79dSRuslan ErmilovPw default options file 95659a3c79dSRuslan Ermilov.It Pa /var/log/userlog 95759a3c79dSRuslan ErmilovUser/group modification logfile 95859a3c79dSRuslan Ermilov.El 959a866e170SRuslan Ermilov.Sh EXIT STATUS 960490d5836SPhilippe CharnierThe 961490d5836SPhilippe Charnier.Nm 962490d5836SPhilippe Charnierutility returns EXIT_SUCCESS on successful operation, otherwise 963137db389SSteve Price.Nm 964137db389SSteve Pricereturns one of the 9659fd0dafcSJoerg Wunschfollowing exit codes defined by 9669fd0dafcSJoerg Wunsch.Xr sysexits 3 9679fd0dafcSJoerg Wunschas follows: 9689fd0dafcSJoerg Wunsch.Bl -tag -width xxxx 9699fd0dafcSJoerg Wunsch.It EX_USAGE 9709fd0dafcSJoerg Wunsch.Bl -bullet -compact 9719fd0dafcSJoerg Wunsch.It 9721dcc6ec7SPhilippe CharnierCommand line syntax errors (invalid keyword, unknown option). 9739fd0dafcSJoerg Wunsch.El 9749fd0dafcSJoerg Wunsch.It EX_NOPERM 9759fd0dafcSJoerg Wunsch.Bl -bullet -compact 9769fd0dafcSJoerg Wunsch.It 9779fd0dafcSJoerg WunschAttempting to run one of the update modes as non-root. 9789fd0dafcSJoerg Wunsch.El 9799fd0dafcSJoerg Wunsch.It EX_OSERR 9809fd0dafcSJoerg Wunsch.Bl -bullet -compact 9819fd0dafcSJoerg Wunsch.It 9829fd0dafcSJoerg WunschMemory allocation error. 9839fd0dafcSJoerg Wunsch.It 9849fd0dafcSJoerg WunschRead error from password file descriptor. 9859fd0dafcSJoerg Wunsch.El 9869fd0dafcSJoerg Wunsch.It EX_DATAERR 9879fd0dafcSJoerg Wunsch.Bl -bullet -compact 9889fd0dafcSJoerg Wunsch.It 9899fd0dafcSJoerg WunschBad or invalid data provided or missing on the command line or 990137db389SSteve Pricevia the password file descriptor. 9919fd0dafcSJoerg Wunsch.It 9929fd0dafcSJoerg WunschAttempted to remove, rename root account or change its uid. 9939fd0dafcSJoerg Wunsch.El 9949fd0dafcSJoerg Wunsch.It EX_OSFILE 9959fd0dafcSJoerg Wunsch.Bl -bullet -compact 9969fd0dafcSJoerg Wunsch.It 9979fd0dafcSJoerg WunschSkeleton directory is invalid or does not exist. 9989fd0dafcSJoerg Wunsch.It 9999fd0dafcSJoerg WunschBase home directory is invalid or does not exist. 10009fd0dafcSJoerg Wunsch.It 1001137db389SSteve PriceInvalid or non-existent shell specified. 10029fd0dafcSJoerg Wunsch.El 10039fd0dafcSJoerg Wunsch.It EX_NOUSER 10049fd0dafcSJoerg Wunsch.Bl -bullet -compact 10059fd0dafcSJoerg Wunsch.It 10069fd0dafcSJoerg WunschUser, user id, group or group id specified does not exist. 10079fd0dafcSJoerg Wunsch.It 1008137db389SSteve PriceUser or group recorded, added, or modified unexpectedly disappeared. 10099fd0dafcSJoerg Wunsch.El 10109fd0dafcSJoerg Wunsch.It EX_SOFTWARE 10119fd0dafcSJoerg Wunsch.Bl -bullet -compact 10129fd0dafcSJoerg Wunsch.It 10139fd0dafcSJoerg WunschNo more group or user ids available within specified range. 10149fd0dafcSJoerg Wunsch.El 10159fd0dafcSJoerg Wunsch.It EX_IOERR 10169fd0dafcSJoerg Wunsch.Bl -bullet -compact 10179fd0dafcSJoerg Wunsch.It 10189fd0dafcSJoerg WunschUnable to rewrite configuration file. 10199fd0dafcSJoerg Wunsch.It 10209fd0dafcSJoerg WunschError updating group or user database files. 10219fd0dafcSJoerg Wunsch.It 10229fd0dafcSJoerg WunschUpdate error for passwd or group database files. 10239fd0dafcSJoerg Wunsch.El 10249fd0dafcSJoerg Wunsch.It EX_CONFIG 10259fd0dafcSJoerg Wunsch.Bl -bullet -compact 10269fd0dafcSJoerg Wunsch.It 10279fd0dafcSJoerg WunschNo base home directory configured. 10289fd0dafcSJoerg Wunsch.El 10299fd0dafcSJoerg Wunsch.El 1030d6f907dcSJoerg Wunsch.Sh SEE ALSO 1031d6f907dcSJoerg Wunsch.Xr chpass 1 , 1032053375e8SMike Pritchard.Xr passwd 1 , 1033eebbeceeSLukas Ertl.Xr umask 2 , 1034d6f907dcSJoerg Wunsch.Xr group 5 , 1035bfd34a4aSWolfram Schneider.Xr login.conf 5 , 1036053375e8SMike Pritchard.Xr passwd 5 , 1037053375e8SMike Pritchard.Xr pw.conf 5 , 1038d6f907dcSJoerg Wunsch.Xr pwd_mkdb 8 , 1039053375e8SMike Pritchard.Xr vipw 8 1040d6f907dcSJoerg Wunsch.Sh HISTORY 1041490d5836SPhilippe CharnierThe 1042490d5836SPhilippe Charnier.Nm 1043490d5836SPhilippe Charnierutility was written to mimic many of the options used in the SYSV 1044d6f907dcSJoerg Wunsch.Em shadow 10459fd0dafcSJoerg Wunschsupport suite, but is modified for passwd and group fields specific to 1046053375e8SMike Pritchardthe 1047053375e8SMike Pritchard.Bx 4.4 10489fd0dafcSJoerg Wunschoperating system, and combines all of the major elements 10499fd0dafcSJoerg Wunschinto a single command. 1050