1.\" $OpenBSD: usermod.8,v 1.31 2015/03/13 19:58:41 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. 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: March 13 2015 $ 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.Bk -words 43.Op Fl moUvZ 44.Op Fl c Ar comment 45.Op Fl d Ar home-directory 46.Op Fl e Ar expiry-time 47.Op Fl f Ar inactive-time 48.Op Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ... 49.Op Fl g Ar gid | name | Li =uid 50.Op Fl L Ar login-class 51.Op Fl l Ar new-login 52.Op Fl p Ar password 53.Op Fl S Ar secondary-group Ns Op , Ns Ar group , Ns ... 54.Op Fl s Ar shell 55.Op Fl u Ar uid 56.Ar user 57.Ek 58.Sh DESCRIPTION 59The 60.Nm 61utility modifies user login information on the system. 62.Pp 63Default values are taken from the information provided in the 64.Pa /etc/usermgmt.conf 65file, which, if running as root, is created using the built-in defaults if 66it does not exist. 67.Pp 68After setting any defaults, and then reading values from 69.Pa /etc/usermgmt.conf , 70the following command line options are processed: 71.Bl -tag -width Ds 72.It Fl c Ar comment 73Sets the comment field (also, for historical reasons known as the 74GECOS field) which will be added for the user, and typically will include 75the user's full name and, perhaps, contact information for the user. 76.It Fl d Ar home-directory 77Sets the home directory to 78.Ar home-directory 79without populating it; if the 80.Fl m 81option is specified, tries to move the old home directory to 82.Ar home-directory . 83.It Fl e Ar expiry-time 84Sets the time at which the account expires. 85It should be entered in the form 86.Dq month day year , 87where month is the month name (the first three characters are 88sufficient), day is the day of the month, and year is the year. 89Time in seconds since the Epoch (UTC) is also valid. 90A value of 0 can be used to disable this feature. 91This value can be preset for new users using the 92.Ar expire 93field in the 94.Pa /etc/usermgmt.conf 95file. 96See 97.Xr usermgmt.conf 5 98for more details. 99.It Fl f Ar inactive-time 100Sets the time at which the password expires. 101See the 102.Fl e 103option. 104.It Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ... 105Appends the user to the given groups in the 106.Pa /etc/group 107file. 108.Fl G 109and 110.Fl S 111are mutually exclusive. 112.It Xo 113.Fl g Ar gid | name | Li =uid 114.Xc 115Gives the group name or identifier to be used for the user's primary group. 116If this is 117.Ql =uid , 118then a UID and GID will be picked which are both unique 119and the same, and a line added to 120.Pa /etc/group 121to describe the new group. 122This value can be preset for all users 123by using the 124.Ar gid 125field in the 126.Pa /etc/usermgmt.conf 127file. 128See 129.Xr usermgmt.conf 5 130for more details. 131.It Fl L Ar login-class 132This option sets the login class for the user being created. 133See 134.Xr login.conf 5 135for more information on user login classes. 136This value can be preset for all users by using the 137.Ar class 138field in the 139.Pa /etc/usermgmt.conf 140file. 141.Xr usermgmt.conf 5 142for more details. 143.It Fl l Ar new-login 144Gives the new user name. 145It must consist of alphanumeric characters, or the characters 146.Ql \&. , 147.Ql \&- 148or 149.Ql \&_ . 150.It Fl m 151Moves the home directory from its old position to the new one. 152If 153.Fl d 154is not specified, the 155.Ar new-user 156argument of the 157.Fl l 158option is used; one of 159.Fl d 160and 161.Fl l 162is needed. 163.It Fl o 164Allows duplicate UIDs to be given. 165.It Fl p Ar password 166Specifies an already-encrypted password for 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