xref: /openbsd-src/usr.sbin/user/usermod.8 (revision 42e2d2b6aaf9f12bacb8087538cd843bc2827549)
1*42e2d2b6Sjmc.\" $OpenBSD: usermod.8,v 1.35 2016/11/30 20:26:37 jmc Exp $
26806f038Smillert.\" $NetBSD: usermod.8,v 1.17 2003/02/14 16:11:37 grant Exp $
3e02380dbSjakob.\"
4e02380dbSjakob.\" Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
5e02380dbSjakob.\"
6e02380dbSjakob.\" Redistribution and use in source and binary forms, with or without
7e02380dbSjakob.\" modification, are permitted provided that the following conditions
8e02380dbSjakob.\" are met:
9e02380dbSjakob.\" 1. Redistributions of source code must retain the above copyright
10e02380dbSjakob.\"    notice, this list of conditions and the following disclaimer.
11e02380dbSjakob.\" 2. Redistributions in binary form must reproduce the above copyright
12e02380dbSjakob.\"    notice, this list of conditions and the following disclaimer in the
13e02380dbSjakob.\"    documentation and/or other materials provided with the distribution.
147a3d14ecSjsg.\" 3. The name of the author may not be used to endorse or promote
15e02380dbSjakob.\"    products derived from this software without specific prior written
16e02380dbSjakob.\"    permission.
17e02380dbSjakob.\"
18e02380dbSjakob.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19e02380dbSjakob.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20e02380dbSjakob.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21e02380dbSjakob.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22e02380dbSjakob.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23e02380dbSjakob.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24e02380dbSjakob.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25e02380dbSjakob.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26e02380dbSjakob.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27e02380dbSjakob.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28e02380dbSjakob.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29e02380dbSjakob.\"
30e02380dbSjakob.\"
31*42e2d2b6Sjmc.Dd $Mdocdate: November 30 2016 $
32e02380dbSjakob.Dt USERMOD 8
338aa50653Sjakob.Os
34e02380dbSjakob.Sh NAME
35e02380dbSjakob.Nm usermod
36e02380dbSjakob.Nd modify user login information
37e02380dbSjakob.Sh SYNOPSIS
3824a3a9d1Smpech.Nm usermod
39c742a9b2Sajacoutot.Op Fl moUvZ
40e02380dbSjakob.Op Fl c Ar comment
410f5c715dSsobrado.Op Fl d Ar home-directory
42e02380dbSjakob.Op Fl e Ar expiry-time
436806f038Smillert.Op Fl f Ar inactive-time
44d3f7b840Sschwarze.Op Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ...
45fadb4645Sschwarze.Op Fl g Ar gid | name | Cm =uid
463c76c7c0Smillert.Op Fl L Ar login-class
47e02380dbSjakob.Op Fl l Ar new-login
48e02380dbSjakob.Op Fl p Ar password
490e0fd575Sajacoutot.Op Fl S Ar secondary-group Ns Op , Ns Ar group , Ns ...
50e02380dbSjakob.Op Fl s Ar shell
51e02380dbSjakob.Op Fl u Ar uid
52e02380dbSjakob.Ar user
53e02380dbSjakob.Sh DESCRIPTION
54e02380dbSjakobThe
55e02380dbSjakob.Nm
56e02380dbSjakobutility modifies user login information on the system.
57e02380dbSjakob.Pp
586806f038SmillertDefault values are taken from the information provided in the
596806f038Smillert.Pa /etc/usermgmt.conf
606806f038Smillertfile, which, if running as root, is created using the built-in defaults if
616806f038Smillertit does not exist.
626806f038Smillert.Pp
636806f038SmillertAfter setting any defaults, and then reading values from
646806f038Smillert.Pa /etc/usermgmt.conf ,
656806f038Smillertthe following command line options are processed:
66e02380dbSjakob.Bl -tag -width Ds
67e02380dbSjakob.It Fl c Ar comment
680f5c715dSsobradoSets the comment field (also, for historical reasons known as the
69e02380dbSjakobGECOS field) which will be added for the user, and typically will include
700870f47dSjmcthe user's full name and, perhaps, contact information for the user.
71e02380dbSjakob.It Fl d Ar home-directory
720f5c715dSsobradoSets the home directory to
733c76c7c0Smillert.Ar home-directory
743c76c7c0Smillertwithout populating it; if the
753c76c7c0Smillert.Fl m
763c76c7c0Smillertoption is specified, tries to move the old home directory to
773c76c7c0Smillert.Ar home-directory .
783f05b322Sjakob.It Fl e Ar expiry-time
790f5c715dSsobradoSets the time at which the account expires.
806806f038SmillertIt should be entered in the form
816806f038Smillert.Dq month day year ,
826806f038Smillertwhere month is the month name (the first three characters are
836806f038Smillertsufficient), day is the day of the month, and year is the year.
844dda51ceSjmcTime in seconds since the Epoch (UTC) is also valid.
854fb31a24SjmcA value of 0 can be used to disable this feature.
8644e41a3bSottoThis value can be preset for new users using the
873f05b322Sjakob.Ar expire
88e02380dbSjakobfield in the
89e02380dbSjakob.Pa /etc/usermgmt.conf
906806f038Smillertfile.
916806f038SmillertSee
926806f038Smillert.Xr usermgmt.conf 5
936806f038Smillertfor more details.
946806f038Smillert.It Fl f Ar inactive-time
950f5c715dSsobradoSets the time at which the password expires.
966806f038SmillertSee the
976806f038Smillert.Fl e
986806f038Smillertoption.
99d3f7b840Sschwarze.It Fl G Ar secondary-group Ns Op , Ns Ar group , Ns ...
1000e0fd575SajacoutotAppends the user to the given groups in the
1010f5c715dSsobrado.Pa /etc/group
1020f5c715dSsobradofile.
1030e0fd575Sajacoutot.Fl G
1040e0fd575Sajacoutotand
1050e0fd575Sajacoutot.Fl S
1060e0fd575Sajacoutotare mutually exclusive.
107*42e2d2b6Sjmc.It Fl g Ar gid | name | Cm =uid
1080f5c715dSsobradoGives the group name or identifier to be used for the user's primary group.
109fadb4645SschwarzeIf this is the special string
110fadb4645Sschwarze.Cm =uid ,
111*42e2d2b6Sjmc.Nm
112*42e2d2b6Sjmccreates a group with the same ID as the UID;
113*42e2d2b6Sjmcif such a group already exists a warning is given
114*42e2d2b6Sjmcand no group is created.
115*42e2d2b6SjmcGroups can be preset for all users by using the
116*42e2d2b6Sjmc.Ar group
117e02380dbSjakobfield in the
1183c76c7c0Smillert.Pa /etc/usermgmt.conf
1196806f038Smillertfile.
1206806f038SmillertSee
1216806f038Smillert.Xr usermgmt.conf 5
1226806f038Smillertfor more details.
1233c76c7c0Smillert.It Fl L Ar login-class
1240f5c715dSsobradoThis option sets the login class for the user being created.
1254fb31a24SjmcSee
1263c76c7c0Smillert.Xr login.conf 5
1274fb31a24Sjmcfor more information on user login classes.
1284fb31a24SjmcThis value can be preset for all users by using the
1293c76c7c0Smillert.Ar class
1303c76c7c0Smillertfield in the
1313c76c7c0Smillert.Pa /etc/usermgmt.conf
1326806f038Smillertfile.
133*42e2d2b6SjmcSee
1346806f038Smillert.Xr usermgmt.conf 5
1356806f038Smillertfor more details.
1360f5c715dSsobrado.It Fl l Ar new-login
1370f5c715dSsobradoGives the new user name.
1383c76c7c0SmillertIt must consist of alphanumeric characters, or the characters
1393c76c7c0Smillert.Ql \&. ,
1403c76c7c0Smillert.Ql \&-
1413c76c7c0Smillertor
1423c76c7c0Smillert.Ql \&_ .
143e02380dbSjakob.It Fl m
1440f5c715dSsobradoMoves the home directory from its old position to the new one.
1453c76c7c0SmillertIf
1463c76c7c0Smillert.Fl d
1473c76c7c0Smillertis not specified, the
1483c76c7c0Smillert.Ar new-user
1493c76c7c0Smillertargument of the
1503c76c7c0Smillert.Fl l
1513c76c7c0Smillertoption is used; one of
1523c76c7c0Smillert.Fl d
1533c76c7c0Smillertand
1543c76c7c0Smillert.Fl l
1553c76c7c0Smillertis needed.
156e02380dbSjakob.It Fl o
1570f5c715dSsobradoAllows duplicate UIDs to be given.
158e02380dbSjakob.It Fl p Ar password
159cda7d927StbSpecifies a password encrypted with
160cda7d927Stb.Xr encrypt 1
161cda7d927Stbfor the user.
162e02380dbSjakobThis password can then be changed by using the
163e02380dbSjakob.Xr chpass 1
164e02380dbSjakobutility.
165e02380dbSjakobThis value can be preset for all users
166e02380dbSjakobby using the
167e02380dbSjakob.Ar password
168e02380dbSjakobfield in the
169e02380dbSjakob.Pa /etc/usermgmt.conf
1706806f038Smillertfile.
1716806f038SmillertSee
1726806f038Smillert.Xr usermgmt.conf 5
1736806f038Smillertfor more details.
1740e0fd575Sajacoutot.It Fl S Ar secondary-group Ns Op , Ns Ar group , Ns ...
1750e0fd575SajacoutotSets the secondary groups the user will be a member of in the
1760e0fd575Sajacoutot.Pa /etc/group
1770e0fd575Sajacoutotfile.
178f440ff29SajacoutotSetting
179f440ff29Sajacoutot.Ar secondary-group
180f440ff29Sajacoutotto an empty value (e.g. '') removes the user
181f440ff29Sajacoutotfrom all secondary groups.
1820e0fd575Sajacoutot.Fl S
1830e0fd575Sajacoutotand
1840e0fd575Sajacoutot.Fl G
1850e0fd575Sajacoutotare mutually exclusive.
186e02380dbSjakob.It Fl s Ar shell
1870f5c715dSsobradoSpecifies the login shell for the user.
188e02380dbSjakobThis value can be preset for all users
189e02380dbSjakobby using the
190e02380dbSjakob.Ar shell
191e02380dbSjakobfield in the
1923c76c7c0Smillert.Pa /etc/usermgmt.conf
1936806f038Smillertfile.
1946806f038SmillertSee
1956806f038Smillert.Xr usermgmt.conf 5
1966806f038Smillertfor more details.
197c742a9b2Sajacoutot.It Fl U
198c742a9b2SajacoutotUnlock the account by removing the trailing
199c742a9b2Sajacoutot.Ql \&-
200c742a9b2Sajacoutotfrom the user's shell and the
201c742a9b2Sajacoutot.Ql \&*
202c742a9b2Sajacoutotprefix from the password.
203c742a9b2Sajacoutot.Fl U
204c742a9b2Sajacoutotand
205c742a9b2Sajacoutot.Fl Z
206c742a9b2Sajacoutotare mutually exclusive and cannot be used with
207c742a9b2Sajacoutot.Fl p .
208e02380dbSjakob.It Fl u Ar uid
2090f5c715dSsobradoSpecifies a new UID for the user.
210e02380dbSjakobBoundaries for this value can be preset for all users
211e02380dbSjakobby using the
212e02380dbSjakob.Ar range
213e02380dbSjakobfield in the
214e02380dbSjakob.Pa /etc/usermgmt.conf
2156806f038Smillertfile.
2166806f038SmillertSee
2176806f038Smillert.Xr usermgmt.conf 5
2186806f038Smillertfor more details.
219e02380dbSjakob.It Fl v
2200f5c715dSsobradoEnables verbose mode - explain the commands as they are executed.
221c742a9b2Sajacoutot.It Fl Z
222c742a9b2SajacoutotLock the account by appending a
223c742a9b2Sajacoutot.Ql \&-
224c742a9b2Sajacoutotto the user's shell and prefixing the password with
225c742a9b2Sajacoutot.Ql \&* .
226c742a9b2Sajacoutot.Fl Z
227c742a9b2Sajacoutotand
228c742a9b2Sajacoutot.Fl U
229c742a9b2Sajacoutotare mutually exclusive and cannot be used with
230c742a9b2Sajacoutot.Fl p .
231e02380dbSjakob.El
232e02380dbSjakob.Pp
2333c76c7c0SmillertOnce the information has been verified,
2343c76c7c0Smillert.Nm
2353c76c7c0Smillertuses
2363c76c7c0Smillert.Xr pwd_mkdb 8
2374fb31a24Sjmcto update the user database.
2380870f47dSjmcThis is run in the background and,
2390870f47dSjmcat very large sites, could take several minutes.
2404fb31a24SjmcUntil this update is completed, the password file is unavailable for other
2414fb31a24Sjmcupdates and the new information is not available to programs.
242e02380dbSjakob.Sh FILES
243e02380dbSjakob.Bl -tag -width /etc/usermgmt.conf -compact
244e02380dbSjakob.It Pa /etc/usermgmt.conf
245e02380dbSjakob.El
246741b6f30Sjmc.Sh EXIT STATUS
247741b6f30Sjmc.Ex -std usermod
248e02380dbSjakob.Sh SEE ALSO
249e02380dbSjakob.Xr chpass 1 ,
2503c76c7c0Smillert.Xr group 5 ,
251b409d2e8Sjmc.Xr passwd 5 ,
2526806f038Smillert.Xr usermgmt.conf 5 ,
2533c76c7c0Smillert.Xr pwd_mkdb 8
2546784aa3eSmillert.Sh STANDARDS
2556784aa3eSmillertOther implementations of the
2566784aa3eSmillert.Nm usermod
2576784aa3eSmillertutility use the
2586784aa3eSmillert.Ar inactive-time
2596784aa3eSmillertparameter to refer to the maximum number of days allowed between logins (this
260a44f4117Sjmcis used to lock "stale" accounts that have not been used for a period of time).
2616784aa3eSmillertHowever, on
2626784aa3eSmillert.Ox
2636784aa3eSmillertsystems this parameter refers instead to the password change time.
2646784aa3eSmillertThis is due to differences in the
2656784aa3eSmillert.Xr passwd 5
2666784aa3eSmillertdatabase compared to other operating systems.
267e02380dbSjakob.Sh HISTORY
268e02380dbSjakobThe
269e02380dbSjakob.Nm
270e02380dbSjakobutility first appeared in
271f88889abSjakob.Ox 2.7 .
272b5667098Smpech.Sh AUTHORS
273e02380dbSjakobThe
274e02380dbSjakob.Nm
2756806f038Smillertutility was written by
27644e68d47Sschwarze.An Alistair G. Crooks Aq Mt agc@NetBSD.org .
277