xref: /netbsd/usr.sbin/user/usermod.8 (revision bf9ec67e)
1.\" $NetBSD: usermod.8,v 1.14 2002/02/08 01:38:57 ross 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-secs
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.
61Default values for the user are taken from the information
62provided in the
63.Pa /etc/usermgmt.conf
64file.
65.Pp
66After setting any defaults, and then values from that file,
67the command line options are processed:
68.Bl -tag -width Ds
69.It Fl G Ar secondary-group
70is the secondary group to which the user will be added in the
71.Pa /etc/group
72file.
73.It Fl c Ar comment
74is the comment field (also, for historical reasons known as the
75GECOS field) which will be added for the user, and typically will include
76the username, and, perhaps, contact information for the user.
77.It Fl d Ar home-directory
78Sets the home directory to
79.Ar home-directory
80without populating it; if the
81.Fl m
82option is specified, tries to move the old home directory to
83.Ar home-directory .
84.It Fl e Ar secs-to-expiry
85provides the number of seconds since the epoch (UTC) at
86which the current password change expire. This
87can be used to implement password aging.
88A value of
890 can be used to switch off this feature.
90The default value for this field is 0.
91See
92.Xr passwd 5
93for more details.
94This value can be preset for all users
95by using the
96.Ar expire
97field in the
98.Pa /etc/usermgmt.conf
99file - it has the format:
100.D1 Ic expire Ar secs-to-expiry
101.It Xo
102.Fl g Ar gid | name | Li =uid
103.Xc
104gives the group name or identifier to be used for the new user's primary group.
105If this is
106.Ql =uid ,
107then a uid and gid will be picked which are both unique
108and the same, and a line added to
109.Pa /etc/group
110to describe the new group.
111This value can be preset for all users
112by using the
113.Ar gid
114field in the
115.Pa /etc/usermgmt.conf
116file - it has the format:
117.br \" XXX Shouldn't be necessary -- mdoc bug? --bjh21
118.Bd -ragged -offset indent -compact
119.Ic group
120.Ar gid | name | Li =uid
121.Ed
122.It Fl L Ar login-class
123This option sets the login class for the user being created.  See
124.Xr login.conf 5
125for more information on user login classes. Thie value can be preset
126for all users by using the
127.Ar class
128field in the
129.Pa /etc/usermgmt.conf
130file - it has the format:
131.br \" XXX skip empty line? - HF
132.Bd -ragged -offset indent -compact
133.Ic class
134.Ar login-class
135.Ed
136.It Fl l Ar new-user
137gives the new user name.
138It must consist of alphanumeric characters, or the characters
139.Ql \&. ,
140.Ql \&-
141or
142.Ql \&_ .
143.It Fl m
144moves the home directory from its old position to the new one.
145If
146.Fl d
147is not specified, the
148.Ar new-user
149argument of the
150.Fl l
151option is used; one of
152.Fl d
153and
154.Fl l
155is needed.
156.It Fl o
157allows duplicate uids to be given.
158.It Fl p Ar password
159specifies an already-encrypted password for the new user.
160This password can then be changed by using the
161.Xr chpass 1
162utility.
163This value can be preset for all users
164by using the
165.Ar password
166field in the
167.Pa /etc/usermgmt.conf
168file - it has the format:
169.D1 Ic password Ar encrypted-password
170.It Fl s Ar shell
171specifies the login shell for the new user.
172This value can be preset for all users
173by using the
174.Ar shell
175field in the
176.Pa /etc/usermgmt.conf
177file - it has the format:
178.D1 Ic shell Ar login-shell
179.It Fl u Ar uid
180specifies a new uid for the user.
181Boundaries for this value can be preset for all users
182by using the
183.Ar range
184field in the
185.Pa /etc/usermgmt.conf
186file - they have the format:
187.br \" XXX
188.Bd -ragged -offset indent -compact
189.Ic range
190.Ar starting-uid Ns Li .. Ns Ar ending_uid
191.Ed
192.It Fl v
193enables verbose mode - explain the commands as they are executed.
194.El
195.Pp
196Once the information has been verified,
197.Nm
198uses
199.Xr pwd_mkdb 8
200to update the user database.  This is run in the background, and,
201at very large sites could take several minutes.  Until this update
202is completed, the password file is unavailable for other updates
203and the new information is not available to programs.
204.Pp
205The
206.Nm
207utility exits 0 on success, and \*[Gt]0 if an error occurs.
208.Sh FILES
209.Bl -tag -width /etc/usermgmt.conf -compact
210.It Pa /etc/usermgmt.conf
211.El
212.Sh SEE ALSO
213.Xr chpass 1 ,
214.Xr group 5 ,
215.Xr passwd 5 ,
216.Xr pwd_mkdb 8
217.Sh HISTORY
218The
219.Nm
220utility first appeared in
221.Nx 1.5 .
222It is based on the
223.Ar addnerd
224package by the same author.
225.Sh AUTHORS
226The
227.Nm
228utility was written by Alistair G. Crooks (agc@netbsd.org).
229