xref: /openbsd-src/usr.sbin/user/usermod.8 (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
1.\" $OpenBSD: usermod.8,v 1.28 2012/01/28 14:25:45 ajacoutot 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 28 2012 $
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 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 Ar uid
203Specifies a new UID for the user.
204Boundaries for this value can be preset for all users
205by using the
206.Ar range
207field in the
208.Pa /etc/usermgmt.conf
209file.
210See
211.Xr usermgmt.conf 5
212for more details.
213.It Fl v
214Enables verbose mode - explain the commands as they are executed.
215.El
216.Pp
217Once the information has been verified,
218.Nm
219uses
220.Xr pwd_mkdb 8
221to update the user database.
222This is run in the background, and,
223at very large sites could take several minutes.
224Until this update is completed, the password file is unavailable for other
225updates and the new information is not available to programs.
226.Sh FILES
227.Bl -tag -width /etc/usermgmt.conf -compact
228.It Pa /etc/usermgmt.conf
229.El
230.Sh EXIT STATUS
231.Ex -std usermod
232.Sh SEE ALSO
233.Xr chpass 1 ,
234.Xr group 5 ,
235.Xr passwd 5 ,
236.Xr usermgmt.conf 5 ,
237.Xr pwd_mkdb 8
238.Sh STANDARDS
239Other implementations of the
240.Nm usermod
241utility use the
242.Ar inactive-time
243parameter to refer to the maximum number of days allowed between logins (this
244is used to lock "stale" accounts that have not been used for a period of time).
245However, on
246.Ox
247systems this parameter refers instead to the password change time.
248This is due to differences in the
249.Xr passwd 5
250database compared to other operating systems.
251.Sh HISTORY
252The
253.Nm
254utility first appeared in
255.Ox 2.7 .
256.Sh AUTHORS
257The
258.Nm
259utility was written by
260.An Alistair G. Crooks Aq agc@NetBSD.org .
261