xref: /openbsd-src/usr.sbin/user/usermod.8 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\" $OpenBSD: usermod.8,v 1.10 2001/08/02 18:37:35 mpech Exp $ */
2.\" $NetBSD: usermod.8,v 1.4 2000/02/28 05:10:57 enami Exp $ */
3.\"
4.\"
5.\" Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by Alistair G. Crooks.
18.\" 4. The name of the author may not be used to endorse or promote
19.\"    products derived from this software without specific prior written
20.\"    permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
23.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
26.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33.\"
34.\"
35.Dd April 3, 2001
36.Dt USERMOD 8
37.Os
38.Sh NAME
39.Nm usermod
40.Nd modify user login information
41.Sh SYNOPSIS
42.Nm usermod
43.Op Fl G Ar secondary-group[,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 password-change-secs
48.Op Fl g Ar gid/name/=uid
49.Op Fl l Ar new-login
50.Op Fl m
51.Op Fl o
52.Op Fl p Ar password
53.Op Fl s Ar shell
54.Op Fl u Ar uid
55.Op Fl v
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[,group,...]
70are the secondary groups the user will be a member of in the
71.Pa /etc/group
72file. This list of groups will replace any old group memberships.
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
78is the home directory which will be created and populated for the user,
79should the -m option be specified.
80.It Fl e Ar expiry-time
81provides the date at which the account expires. This should be given
82in a standard time format (%c). This is unset by default.
83This value can be preset for all users by using the
84.Ar expire
85field in /etc/usermgmt.conf file - it has the format:
86.Ar expire <expiry-time> .
87.It Fl f Ar password-change-secs
88provides the number of seconds since the epoch (UTC) at
89which the current password change expire. This
90can be used to implement password aging.
91A value of
920 can be used to switch off this feature.
93The default value for this field is 0.
94See
95.Xr passwd 5
96for more details.
97This value can be preset for all users
98by using the
99.Ar inactive
100field in the
101.Pa /etc/usermgmt.conf
102file - it has the format:
103.Ar inactive <password-change-secs> .
104.It Fl g Ar gid/name/=uid
105gives the group name or identifier to be used for the new user's primary group.
106If this is
107.Ar "-g=uid" ,
108then a uid and gid will be picked which are both unique
109and the same, and a line added to
110.Pa /etc/group
111to describe the new group.
112This value can be preset for all users
113by using the
114.Ar gid
115field in the
116.Xr /usr/share/adduser/defaults
117file - it has the format:
118.Ar group <groupname/groupid/=uid> .
119.It Fl l Ar new-user
120gives the new user name.
121It must consist of alphanumeric characters, or the characters '.', '-' or '_'.
122.It Fl m
123moves the home directory from its old position to the new one.
124.It Fl o
125allows duplicate uids to be given.
126.It Fl p Ar password
127specifies an already-encrypted password for the new user.
128This password can then be changed by using the
129.Xr chpass 1
130utility.
131This value can be preset for all users
132by using the
133.Ar password
134field in the
135.Pa /etc/usermgmt.conf
136file - it has the format:
137.Ar password <encrypted-password> .
138.It Fl s Ar shell
139specifies the login shell for the new user.
140This value can be preset for all users
141by using the
142.Ar shell
143field in the
144.Xr /usr/share/adduser/defaults
145file - it has the format:
146.Ar shell <login-shell> .
147.It Fl u Ar uid
148specifies a new uid for the user.
149Boundaries for this value can be preset for all users
150by using the
151.Ar range
152field in the
153.Pa /etc/usermgmt.conf
154file - they have the format:
155.Ar range <starting-uid>..<ending_uid> .
156.It Fl v
157enables verbose mode - explain the commands as they are executed.
158.El
159.Pp
160The
161.Nm
162utility exits 0 on success, and >0 if an error occurs.
163.Sh FILES
164.Bl -tag -width /etc/usermgmt.conf -compact
165.It Pa /etc/usermgmt.conf
166.It Pa /etc/skel/.[A-z]*
167.El
168.Sh SEE ALSO
169.Xr chpass 1 ,
170.Xr passwd 5 ,
171.Xr group 5
172.Sh HISTORY
173The
174.Nm
175utility first appeared in
176.Ox 2.7 .
177.Sh AUTHORS
178The
179.Nm
180utility was written by Alistair G. Crooks (agc@netbsd.org).
181