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