1.\" $OpenBSD: usermod.8,v 1.33 2016/08/16 11:33:07 tb Exp $ 2.\" $NetBSD: usermod.8,v 1.17 2003/02/14 16:11:37 grant Exp $ 3.\" 4.\" Copyright (c) 1999 Alistair G. Crooks. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by Alistair G. Crooks. 17.\" 4. The name of the author may not be used to endorse or promote 18.\" products derived from this software without specific prior written 19.\" permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 22.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 25.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 27.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32.\" 33.\" 34.Dd $Mdocdate: August 16 2016 $ 35.Dt USERMOD 8 36.Os 37.Sh NAME 38.Nm usermod 39.Nd modify user login information 40.Sh SYNOPSIS 41.Nm usermod 42.Op Fl moUvZ 43.Op Fl c Ar comment 44.Op Fl d Ar home-directory 45.Op Fl e Ar expiry-time 46.Op Fl f Ar inactive-time 47.Op Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ... 48.Op Fl g Ar gid | name | Cm =uid 49.Op Fl L Ar login-class 50.Op Fl l Ar new-login 51.Op Fl p Ar password 52.Op Fl S Ar secondary-group Ns Op , Ns Ar group , Ns ... 53.Op Fl s Ar shell 54.Op Fl u Ar uid 55.Ar user 56.Sh DESCRIPTION 57The 58.Nm 59utility modifies user login information on the system. 60.Pp 61Default values are taken from the information provided in the 62.Pa /etc/usermgmt.conf 63file, which, if running as root, is created using the built-in defaults if 64it does not exist. 65.Pp 66After setting any defaults, and then reading values from 67.Pa /etc/usermgmt.conf , 68the following command line options are processed: 69.Bl -tag -width Ds 70.It Fl c Ar comment 71Sets the comment field (also, for historical reasons known as the 72GECOS field) which will be added for the user, and typically will include 73the user's full name and, perhaps, contact information for the user. 74.It Fl d Ar home-directory 75Sets the home directory to 76.Ar home-directory 77without populating it; if the 78.Fl m 79option is specified, tries to move the old home directory to 80.Ar home-directory . 81.It Fl e Ar expiry-time 82Sets the time at which the account expires. 83It should be entered in the form 84.Dq month day year , 85where month is the month name (the first three characters are 86sufficient), day is the day of the month, and year is the year. 87Time in seconds since the Epoch (UTC) is also valid. 88A value of 0 can be used to disable this feature. 89This value can be preset for new users using the 90.Ar expire 91field in the 92.Pa /etc/usermgmt.conf 93file. 94See 95.Xr usermgmt.conf 5 96for more details. 97.It Fl f Ar inactive-time 98Sets the time at which the password expires. 99See the 100.Fl e 101option. 102.It Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ... 103Appends the user to the given groups in the 104.Pa /etc/group 105file. 106.Fl G 107and 108.Fl S 109are mutually exclusive. 110.It Xo 111.Fl g Ar gid | name | Cm =uid 112.Xc 113Gives the group name or identifier to be used for the user's primary group. 114If this is the special string 115.Cm =uid , 116then a UID and GID will be picked which are both unique 117and the same, and a line added to 118.Pa /etc/group 119to describe the new group. 120This value can be preset for all users 121by using the 122.Ar gid 123field in the 124.Pa /etc/usermgmt.conf 125file. 126See 127.Xr usermgmt.conf 5 128for more details. 129.It Fl L Ar login-class 130This option sets the login class for the user being created. 131See 132.Xr login.conf 5 133for more information on user login classes. 134This value can be preset for all users by using the 135.Ar class 136field in the 137.Pa /etc/usermgmt.conf 138file. 139.Xr usermgmt.conf 5 140for more details. 141.It Fl l Ar new-login 142Gives the new user name. 143It must consist of alphanumeric characters, or the characters 144.Ql \&. , 145.Ql \&- 146or 147.Ql \&_ . 148.It Fl m 149Moves the home directory from its old position to the new one. 150If 151.Fl d 152is not specified, the 153.Ar new-user 154argument of the 155.Fl l 156option is used; one of 157.Fl d 158and 159.Fl l 160is needed. 161.It Fl o 162Allows duplicate UIDs to be given. 163.It Fl p Ar password 164Specifies a password encrypted with 165.Xr encrypt 1 166for the user. 167This password can then be changed by using the 168.Xr chpass 1 169utility. 170This value can be preset for all users 171by using the 172.Ar password 173field in the 174.Pa /etc/usermgmt.conf 175file. 176See 177.Xr usermgmt.conf 5 178for more details. 179.It Fl S Ar secondary-group Ns Op , Ns Ar group , Ns ... 180Sets the secondary groups the user will be a member of in the 181.Pa /etc/group 182file. 183Setting 184.Ar secondary-group 185to an empty value (e.g. '') removes the user 186from all secondary groups. 187.Fl S 188and 189.Fl G 190are mutually exclusive. 191.It Fl s Ar shell 192Specifies the login shell for the user. 193This value can be preset for all users 194by using the 195.Ar shell 196field in the 197.Pa /etc/usermgmt.conf 198file. 199See 200.Xr usermgmt.conf 5 201for more details. 202.It Fl U 203Unlock the account by removing the trailing 204.Ql \&- 205from the user's shell and the 206.Ql \&* 207prefix from the password. 208.Fl U 209and 210.Fl Z 211are mutually exclusive and cannot be used with 212.Fl p . 213.It Fl u Ar uid 214Specifies a new UID for the user. 215Boundaries for this value can be preset for all users 216by using the 217.Ar range 218field in the 219.Pa /etc/usermgmt.conf 220file. 221See 222.Xr usermgmt.conf 5 223for more details. 224.It Fl v 225Enables verbose mode - explain the commands as they are executed. 226.It Fl Z 227Lock the account by appending a 228.Ql \&- 229to the user's shell and prefixing the password with 230.Ql \&* . 231.Fl Z 232and 233.Fl U 234are mutually exclusive and cannot be used with 235.Fl p . 236.El 237.Pp 238Once the information has been verified, 239.Nm 240uses 241.Xr pwd_mkdb 8 242to update the user database. 243This is run in the background and, 244at very large sites, could take several minutes. 245Until this update is completed, the password file is unavailable for other 246updates and the new information is not available to programs. 247.Sh FILES 248.Bl -tag -width /etc/usermgmt.conf -compact 249.It Pa /etc/usermgmt.conf 250.El 251.Sh EXIT STATUS 252.Ex -std usermod 253.Sh SEE ALSO 254.Xr chpass 1 , 255.Xr group 5 , 256.Xr passwd 5 , 257.Xr usermgmt.conf 5 , 258.Xr pwd_mkdb 8 259.Sh STANDARDS 260Other implementations of the 261.Nm usermod 262utility use the 263.Ar inactive-time 264parameter to refer to the maximum number of days allowed between logins (this 265is used to lock "stale" accounts that have not been used for a period of time). 266However, on 267.Ox 268systems this parameter refers instead to the password change time. 269This is due to differences in the 270.Xr passwd 5 271database compared to other operating systems. 272.Sh HISTORY 273The 274.Nm 275utility first appeared in 276.Ox 2.7 . 277.Sh AUTHORS 278The 279.Nm 280utility was written by 281.An Alistair G. Crooks Aq Mt agc@NetBSD.org . 282