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