xref: /netbsd/usr.sbin/user/usermod.8 (revision c4a72b64)
1.\" $NetBSD: usermod.8,v 1.16 2002/06/10 08:33:06 grant 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 mov
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 c Ar comment
76is the comment field (also, for historical reasons known as the
77GECOS field) which will be added for the user, and typically will include
78the username, and, perhaps, contact information for the user.
79.It Fl d Ar home-directory
80Sets the home directory to
81.Ar home-directory
82without populating it; if the
83.Fl m
84option is specified, tries to move the old home directory to
85.Ar home-directory .
86.It Fl e Ar expiry-time
87sets the time at which the current password expires.  This can be used
88to implement password aging.  It should be entered in the form
89.Dq month day year ,
90where month is the month name (the first three characters are
91sufficient), day is the day of the month, and year is the year.
92Time in seconds since the epoch (UTC) is also valid.  A value of
930 can be used to disable this feature.
94This value can be preset for all users using the
95.Ar expire
96field in the
97.Pa /etc/usermgmt.conf
98file.
99See
100.Xr usermgmt.conf 5
101for more details.
102.It Fl f Ar inactive-time
103sets the time at which the account expires.
104See the
105.Fl e
106option.
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.  See
128.Xr login.conf 5
129for more information on user login classes. This value can be preset
130for all users by using the
131.Ar class
132field in the
133.Pa /etc/usermgmt.conf
134file.
135See
136.Xr usermgmt.conf 5
137for more details.
138.It Fl l Ar new-user
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.  This is run in the background, and,
205at very large sites could take several minutes.  Until this update
206is completed, the password file is unavailable for other updates
207and the new information is not available to programs.
208.Pp
209The
210.Nm
211utility exits 0 on success, and \*[Gt]0 if an error occurs.
212.Sh FILES
213.Bl -tag -width /etc/usermgmt.conf -compact
214.It Pa /etc/usermgmt.conf
215.El
216.Sh SEE ALSO
217.Xr chpass 1 ,
218.Xr group 5 ,
219.Xr passwd 5 ,
220.Xr usermgmt.conf 5 ,
221.Xr pwd_mkdb 8
222.Sh HISTORY
223The
224.Nm
225utility first appeared in
226.Nx 1.5 .
227It is based on the
228.Ar addnerd
229package by the same author.
230.Sh AUTHORS
231The
232.Nm
233utility was written by Alistair G. Crooks (agc@netbsd.org).
234