xref: /netbsd-src/usr.sbin/user/usermod.8 (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1.\" $NetBSD: usermod.8,v 1.30 2008/07/18 21:03:03 apb Exp $ */
2.\"
3.\" Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. The name of the author may not be used to endorse or promote
14.\"    products derived from this software without specific prior written
15.\"    permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\"
30.Dd July 18, 2008
31.Dt USERMOD 8
32.Os
33.Sh NAME
34.Nm usermod
35.Nd modify user login information
36.Sh SYNOPSIS
37.Nm
38.Op Fl FmoSv
39.Op Fl C Ar yes/no
40.Op Fl c Ar comment
41.Op Fl d Ar home-dir
42.Op Fl e Ar expiry-time
43.Op Fl f Ar inactive-time
44.Op Fl G Ar secondary-group
45.Op Fl g Ar gid | name | Li =uid
46.Op Fl L Ar login-class
47.Op Fl l Ar new-login
48.Op Fl p Ar password
49.Op Fl s Ar shell
50.Op Fl u Ar uid
51.Ar user
52.Sh DESCRIPTION
53The
54.Nm
55utility modifies user login information on the system.
56.Pp
57Default values are taken from the information provided in the
58.Pa /etc/usermgmt.conf
59file, which, if running as root, is created using the built-in defaults if
60it does not exist.
61.Pp
62See
63.Xr user 8
64for more information about
65.Dv EXTENSIONS .
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 yes/no
72Enable user accounts to be temporary locked/closed.
73The
74.Ar yes/no
75operand can be given as
76.Dq Ar yes
77to lock the account or
78.Dq Ar no
79to unlock the account.
80.It Fl c Ar comment
81Set the comment field (also, for historical reasons known as the
82GECOS field) for the user.
83The comment field will typically include
84the user's full name and, perhaps, contact information for the user.
85.It Fl d Ar home-directory
86Set the home directory.
87without populating it; if the
88.Fl m
89option is specified, tries to move the old home directory to
90.Ar home-directory .
91.It Fl e Ar expiry-time
92Set the time at which the account expires.
93This can be used to implement password aging.
94It should be entered in the form
95.Dq month day year ,
96where month is the month name (the first three characters are
97sufficient), day is the day of the month, and year is the year.
98Time in seconds since the epoch (UTC) is also valid.
99A value of 0 can be used to disable this feature.
100This value can be preset for all users using the
101.Ar expire
102field in the
103.Pa /etc/usermgmt.conf
104file.
105See
106.Xr usermgmt.conf 5
107for more details.
108.It Fl F
109Force the user to change their password upon next login.
110.It Fl f Ar inactive-time
111Set the time at which the password expires.
112See the
113.Fl e
114option.
115.It Fl G Ar secondary-group
116Specify a secondary group to which the user will be added in the
117.Pa /etc/group
118file.
119.It Fl g Ar gid | name | Li =uid
120Give the group name or identifier to be used for the user's primary group.
121If this is
122.Ql =uid ,
123then a uid and gid will be picked which are both unique
124and the same, and a line will be added to
125.Pa /etc/group
126to describe the new group.
127This value can be preset for all users by using the
128.Ar group
129field in the
130.Pa /etc/usermgmt.conf
131file.
132See
133.Xr usermgmt.conf 5
134for more details.
135.It Fl L Ar login-class
136Set the login class for the user.
137See
138.Xr login.conf 5
139for more information on user login classes.
140This value can be preset for all users by using the
141.Ar class
142field in the
143.Pa /etc/usermgmt.conf
144file.
145See
146.Xr usermgmt.conf 5
147for more details.
148This option is included if built with
149.Dv EXTENSIONS .
150.It Fl l Ar new-user
151Give the new user name.
152It can consist of alphanumeric characters and the characters
153.Ql \&. ,
154.Ql \&- ,
155and
156.Ql \&_ .
157.It Fl m
158Move the home directory from its old position to the new one.
159If
160.Fl d
161is not specified, the
162.Ar new-user
163argument of the
164.Fl l
165option is used; one of
166.Fl d
167and
168.Fl l
169is needed.
170.It Fl o
171Allow duplicate uids to be given.
172.It Fl p Ar password
173Specify an already-encrypted password for the user.
174This password can then be changed by using the
175.Xr chpass 1
176utility.
177This value can be preset for all users by using the
178.Ar password
179field in the
180.Pa /etc/usermgmt.conf
181file.
182See
183.Xr usermgmt.conf 5
184for more details.
185This option is included if built with
186.Dv EXTENSIONS .
187.It Fl S
188Allow samba user names with a trailing dollar sign to be modified.
189This option is included if built with
190.Dv EXTENSIONS .
191.It Fl s Ar shell
192Specify the login shell for the user.
193This value can be preset for all users by using the
194.Ar shell
195field in the
196.Pa /etc/usermgmt.conf
197file.
198See
199.Xr usermgmt.conf 5
200for more details.
201.It Fl u Ar uid
202Specify a new uid for the user.
203Boundaries for this value can be preset for all users by using the
204.Ar range
205field in the
206.Pa /etc/usermgmt.conf
207file.
208See
209.Xr usermgmt.conf 5
210for more details.
211.It Fl v
212Enable verbose mode - explain the commands as they are executed.
213This option is included if built with
214.Dv EXTENSIONS .
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.
223At very large sites this can take several minutes.
224Until this update
225is completed, the password file is unavailable for other updates
226and the new information is not available to programs.
227.Sh EXIT STATUS
228.Ex -std usermod
229.Sh FILES
230.Bl -tag -width /etc/usermgmt.conf -compact
231.It Pa /etc/usermgmt.conf
232.El
233.Sh SEE ALSO
234.Xr chpass 1 ,
235.Xr group 5 ,
236.Xr passwd 5 ,
237.Xr usermgmt.conf 5 ,
238.Xr pwd_mkdb 8 ,
239.Xr user 8 ,
240.Xr useradd 8 ,
241.Xr userdel 8
242.Sh HISTORY
243The
244.Nm
245utility first appeared in
246.Nx 1.5 .
247It is based on the
248.Ar addnerd
249package by the same author.
250.Sh AUTHORS
251The
252.Nm
253utility was written by
254.An Alistair G. Crooks
255.Aq agc@NetBSD.org .
256