xref: /netbsd/usr.sbin/user/usermod.8 (revision 6550d01e)
1.\" $NetBSD: usermod.8,v 1.32 2009/03/11 17:54:03 dyoung 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 January 13, 2009
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 without populating it; if the
87.Fl m
88option is specified, tries to move the old home directory to
89.Ar home-directory .
90.It Fl e Ar expiry-time
91Set the time at which the account expires.
92This can be used to implement password aging.
93It should be entered in the form
94.Dq month day year ,
95where month is the month name (the first three characters are
96sufficient), day is the day of the month, and year is the year.
97Time in seconds since the epoch (UTC) is also valid.
98A value of 0 can be used to disable this feature.
99This value can be preset for all users using the
100.Ar expire
101field in the
102.Pa /etc/usermgmt.conf
103file.
104See
105.Xr usermgmt.conf 5
106for more details.
107.It Fl F
108Force the user to change their password upon next login.
109.It Fl f Ar inactive-time
110Set the time at which the password expires.
111See the
112.Fl e
113option.
114.It Fl G Ar secondary-group
115Specify a secondary group to which the user will be added in the
116.Pa /etc/group
117file.
118The
119.Ar secondary-group
120may be a comma-delimited list for multiple groups.
121Or the option may be repeated for multiple groups.
122(16 groups maximum.)
123.It Fl g Ar gid | name | Li =uid
124Give the group name or identifier to be used for the user's primary group.
125If this is
126.Ql =uid ,
127then a uid and gid will be picked which are both unique
128and the same, and a line will be added to
129.Pa /etc/group
130to describe the new group.
131This value can be preset for all users by using the
132.Ar group
133field in the
134.Pa /etc/usermgmt.conf
135file.
136See
137.Xr usermgmt.conf 5
138for more details.
139.It Fl L Ar login-class
140Set the login class for the user.
141See
142.Xr login.conf 5
143for more information on user login classes.
144This value can be preset for all users by using the
145.Ar class
146field in the
147.Pa /etc/usermgmt.conf
148file.
149See
150.Xr usermgmt.conf 5
151for more details.
152This option is included if built with
153.Dv EXTENSIONS .
154.It Fl l Ar new-user
155Give the new user name.
156It can consist of alphanumeric characters and the characters
157.Ql \&. ,
158.Ql \&- ,
159and
160.Ql \&_ .
161.It Fl m
162Move the home directory from its old position to the new one.
163If
164.Fl d
165is not specified, the
166.Ar new-user
167argument of the
168.Fl l
169option is used; one of
170.Fl d
171and
172.Fl l
173is needed.
174.It Fl o
175Allow duplicate uids to be given.
176.It Fl p Ar password
177Specify an already-encrypted password for the user.
178This password can then be changed by using the
179.Xr chpass 1
180utility.
181This value can be preset for all users by using the
182.Ar password
183field in the
184.Pa /etc/usermgmt.conf
185file.
186See
187.Xr usermgmt.conf 5
188for more details.
189This option is included if built with
190.Dv EXTENSIONS .
191.It Fl S
192Allow samba user names with a trailing dollar sign to be modified.
193This option is included if built with
194.Dv EXTENSIONS .
195.It Fl s Ar shell
196Specify the login shell for the user.
197This value can be preset for all users by using the
198.Ar shell
199field in the
200.Pa /etc/usermgmt.conf
201file.
202See
203.Xr usermgmt.conf 5
204for more details.
205.It Fl u Ar uid
206Specify a new uid for the user.
207Boundaries for this value can be preset for all users by using the
208.Ar range
209field in the
210.Pa /etc/usermgmt.conf
211file.
212See
213.Xr usermgmt.conf 5
214for more details.
215.It Fl v
216Enable verbose mode - explain the commands as they are executed.
217This option is included if built with
218.Dv EXTENSIONS .
219.El
220.Pp
221Once the information has been verified,
222.Nm
223uses
224.Xr pwd_mkdb 8
225to update the user database.
226This is run in the background.
227At very large sites this can take several minutes.
228Until this update
229is completed, the password file is unavailable for other updates
230and the new information is not available to programs.
231.Sh EXIT STATUS
232.Ex -std usermod
233.Sh FILES
234.Bl -tag -width /etc/usermgmt.conf -compact
235.It Pa /etc/usermgmt.conf
236.El
237.Sh SEE ALSO
238.Xr chpass 1 ,
239.Xr group 5 ,
240.Xr passwd 5 ,
241.Xr usermgmt.conf 5 ,
242.Xr pwd_mkdb 8 ,
243.Xr user 8 ,
244.Xr useradd 8 ,
245.Xr userdel 8
246.Sh HISTORY
247The
248.Nm
249utility first appeared in
250.Nx 1.5 .
251It is based on the
252.Ar addnerd
253package by the same author.
254.Sh AUTHORS
255The
256.Nm
257utility was written by
258.An Alistair G. Crooks
259.Aq agc@NetBSD.org .
260