xref: /netbsd-src/usr.sbin/user/usermod.8 (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1.\" $NetBSD: usermod.8,v 1.19 2004/01/14 09:35:33 agc Exp $ */
2.\"
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 September 5, 2001
35.Dt USERMOD 8
36.Os
37.Sh NAME
38.Nm usermod
39.Nd modify user login information
40.Sh SYNOPSIS
41.Nm
42.Op Fl Smov
43.Op Fl G Ar secondary-group
44.Op Fl c Ar comment
45.Op Fl d Ar home-dir
46.Op Fl e Ar expiry-time
47.Op Fl f Ar inactive-time
48.Oo
49.Fl g Ar gid | name | Li =uid
50.Oc
51.Op Fl L Ar login-class
52.Op Fl l Ar new-login
53.Op Fl p Ar password
54.Op Fl s Ar shell
55.Op Fl u Ar uid
56.Ar user
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 G Ar secondary-group
72is the secondary group to which the user will be added in the
73.Pa /etc/group
74file.
75.It Fl S
76allows samba user names with a trailing dollar sign to be
77modified.
78.It Fl c Ar comment
79is the comment field (also, for historical reasons known as the
80GECOS field) which will be added for the user, and typically will include
81the user's full name, and, perhaps, contact information for the user.
82.It Fl d Ar home-directory
83Sets the home directory to
84.Ar home-directory
85without populating it; if the
86.Fl m
87option is specified, tries to move the old home directory to
88.Ar home-directory .
89.It Fl e Ar expiry-time
90sets the time at which the current password expires.  This can be used
91to implement password aging.  It should be entered in the form
92.Dq month day year ,
93where month is the month name (the first three characters are
94sufficient), day is the day of the month, and year is the year.
95Time in seconds since the epoch (UTC) is also valid.  A value of
960 can be used to disable this feature.
97This value can be preset for all users using the
98.Ar expire
99field in the
100.Pa /etc/usermgmt.conf
101file.
102See
103.Xr usermgmt.conf 5
104for more details.
105.It Fl f Ar inactive-time
106sets the time at which the account expires.
107See the
108.Fl e
109option.
110.It Xo
111.Fl g Ar gid | name | Li =uid
112.Xc
113gives the group name or identifier to be used for the user's primary group.
114If this is
115.Ql =uid ,
116then a uid and gid will be picked which are both unique
117and the same, and a line added to
118.Pa /etc/group
119to describe the new group.
120This value can be preset for all users
121by using the
122.Ar gid
123field in the
124.Pa /etc/usermgmt.conf
125file.
126See
127.Xr usermgmt.conf 5
128for more details.
129.It Fl L Ar login-class
130This option sets the login class for the user.  See
131.Xr login.conf 5
132for more information on user login classes. This value can be preset
133for all users by using the
134.Ar class
135field in the
136.Pa /etc/usermgmt.conf
137file.
138See
139.Xr usermgmt.conf 5
140for more details.
141.It Fl l Ar new-user
142gives the new user name.
143It must consist of alphanumeric characters, or the characters
144.Ql \&. ,
145.Ql \&-
146or
147.Ql \&_ .
148.It Fl m
149moves the home directory from its old position to the new one.
150If
151.Fl d
152is not specified, the
153.Ar new-user
154argument of the
155.Fl l
156option is used; one of
157.Fl d
158and
159.Fl l
160is needed.
161.It Fl o
162allows duplicate uids to be given.
163.It Fl p Ar password
164specifies an already-encrypted password for the user.
165This password can then be changed by using the
166.Xr chpass 1
167utility.
168This value can be preset for all users
169by using the
170.Ar password
171field in the
172.Pa /etc/usermgmt.conf
173file.
174See
175.Xr usermgmt.conf 5
176for more details.
177.It Fl s Ar shell
178specifies the login shell for the user.
179This value can be preset for all users
180by using the
181.Ar shell
182field in the
183.Pa /etc/usermgmt.conf
184file.
185See
186.Xr usermgmt.conf 5
187for more details.
188.It Fl u Ar uid
189specifies a new uid for the user.
190Boundaries for this value can be preset for all users
191by using the
192.Ar range
193field in the
194.Pa /etc/usermgmt.conf
195file.
196See
197.Xr usermgmt.conf 5
198for more details.
199.It Fl v
200enables verbose mode - explain the commands as they are executed.
201.El
202.Pp
203Once the information has been verified,
204.Nm
205uses
206.Xr pwd_mkdb 8
207to update the user database.  This is run in the background, and,
208at very large sites could take several minutes.  Until this update
209is completed, the password file is unavailable for other updates
210and the new information is not available to programs.
211.Pp
212The
213.Nm
214utility exits 0 on success, and \*[Gt]0 if an error occurs.
215.Sh FILES
216.Bl -tag -width /etc/usermgmt.conf -compact
217.It Pa /etc/usermgmt.conf
218.El
219.Sh SEE ALSO
220.Xr chpass 1 ,
221.Xr group 5 ,
222.Xr passwd 5 ,
223.Xr usermgmt.conf 5 ,
224.Xr pwd_mkdb 8
225.Sh HISTORY
226The
227.Nm
228utility first appeared in
229.Nx 1.5 .
230It is based on the
231.Ar addnerd
232package by the same author.
233.Sh AUTHORS
234The
235.Nm
236utility was written by
237.An Alistair G. Crooks
238.Aq agc@NetBSD.org .
239