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