xref: /openbsd/usr.sbin/user/usermod.8 (revision 404b540a)
1.\" $OpenBSD: usermod.8,v 1.23 2009/01/21 16:56:03 sobrado 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: January 21 2009 $
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 mov
44.Op Fl G Ar secondary-group[,group,...]
45.Op Fl c Ar comment
46.Op Fl d Ar home-directory
47.Op Fl e Ar expiry-time
48.Op Fl f Ar inactive-time
49.Oo
50.Fl g Ar gid | name | Li =uid
51.Oc
52.Op Fl L Ar login-class
53.Op Fl l Ar new-login
54.Op Fl p Ar password
55.Op Fl s Ar shell
56.Op Fl u Ar uid
57.Ar user
58.Ek
59.Sh DESCRIPTION
60The
61.Nm
62utility modifies user login information on the system.
63.Pp
64Default values are taken from the information provided in the
65.Pa /etc/usermgmt.conf
66file, which, if running as root, is created using the built-in defaults if
67it does not exist.
68.Pp
69After setting any defaults, and then reading values from
70.Pa /etc/usermgmt.conf ,
71the following command line options are processed:
72.Bl -tag -width Ds
73.It Fl c Ar comment
74Sets the comment field (also, for historical reasons known as the
75GECOS field) which will be added for the user, and typically will include
76the user's full name, and, perhaps, contact information for the user.
77.It Fl d Ar home-directory
78Sets the home directory to
79.Ar home-directory
80without populating it; if the
81.Fl m
82option is specified, tries to move the old home directory to
83.Ar home-directory .
84.It Fl e Ar expiry-time
85Sets the time at which the account expires.
86It should be entered in the form
87.Dq month day year ,
88where month is the month name (the first three characters are
89sufficient), day is the day of the month, and year is the year.
90Time in seconds since the Epoch (UTC) is also valid.
91A value of 0 can be used to disable this feature.
92This value can be preset for new users using the
93.Ar expire
94field in the
95.Pa /etc/usermgmt.conf
96file.
97See
98.Xr usermgmt.conf 5
99for more details.
100.It Fl f Ar inactive-time
101Sets the time at which the password expires.
102See the
103.Fl e
104option.
105.It Fl G Ar secondary-group[,group,...]
106Sets the secondary groups the user will be a member of in the
107.Pa /etc/group
108file.
109.It Xo
110.Fl g Ar gid | name | Li =uid
111.Xc
112Gives the group name or identifier to be used for the user's primary group.
113If this is
114.Ql =uid ,
115then a UID and GID will be picked which are both unique
116and the same, and a line added to
117.Pa /etc/group
118to describe the new group.
119This value can be preset for all users
120by using the
121.Ar gid
122field in the
123.Pa /etc/usermgmt.conf
124file.
125See
126.Xr usermgmt.conf 5
127for more details.
128.It Fl L Ar login-class
129This option sets the login class for the user being created.
130See
131.Xr login.conf 5
132for more information on user login classes.
133This value can be preset for all users by using the
134.Ar class
135field in the
136.Pa /etc/usermgmt.conf
137file.
138.Xr usermgmt.conf 5
139for more details.
140.It Fl l Ar new-login
141Gives the new user name.
142It must consist of alphanumeric characters, or the characters
143.Ql \&. ,
144.Ql \&-
145or
146.Ql \&_ .
147.It Fl m
148Moves the home directory from its old position to the new one.
149If
150.Fl d
151is not specified, the
152.Ar new-user
153argument of the
154.Fl l
155option is used; one of
156.Fl d
157and
158.Fl l
159is needed.
160.It Fl o
161Allows duplicate UIDs to be given.
162.It Fl p Ar password
163Specifies an already-encrypted password for the user.
164This password can then be changed by using the
165.Xr chpass 1
166utility.
167This value can be preset for all users
168by using the
169.Ar password
170field in the
171.Pa /etc/usermgmt.conf
172file.
173See
174.Xr usermgmt.conf 5
175for more details.
176.It Fl s Ar shell
177Specifies the login shell for the user.
178This value can be preset for all users
179by using the
180.Ar shell
181field in the
182.Pa /etc/usermgmt.conf
183file.
184See
185.Xr usermgmt.conf 5
186for more details.
187.It Fl u Ar uid
188Specifies a new UID for the user.
189Boundaries for this value can be preset for all users
190by using the
191.Ar range
192field in the
193.Pa /etc/usermgmt.conf
194file.
195See
196.Xr usermgmt.conf 5
197for more details.
198.It Fl v
199Enables verbose mode - explain the commands as they are executed.
200.El
201.Pp
202Once the information has been verified,
203.Nm
204uses
205.Xr pwd_mkdb 8
206to update the user database.
207This is run in the background, and,
208at very large sites could take several minutes.
209Until this update is completed, the password file is unavailable for other
210updates and the new information is not available to programs.
211.Pp
212.Ex -std usermod
213.Sh FILES
214.Bl -tag -width /etc/usermgmt.conf -compact
215.It Pa /etc/usermgmt.conf
216.El
217.Sh SEE ALSO
218.Xr chpass 1 ,
219.Xr group 5 ,
220.Xr passwd 5 ,
221.Xr usermgmt.conf 5 ,
222.Xr pwd_mkdb 8
223.Sh STANDARDS
224Other implementations of the
225.Nm usermod
226utility use the
227.Ar inactive-time
228parameter to refer to the maximum number of days allowed between logins (this
229is used to lock "stale" accounts that have not been used for a period of time).
230However, on
231.Ox
232systems this parameter refers instead to the password change time.
233This is due to differences in the
234.Xr passwd 5
235database compared to other operating systems.
236.Sh HISTORY
237The
238.Nm
239utility first appeared in
240.Ox 2.7 .
241.Sh AUTHORS
242The
243.Nm
244utility was written by
245.An Alistair G. Crooks Aq agc@NetBSD.org .
246