xref: /openbsd/usr.sbin/user/userdel.8 (revision 09467b48)
1.\" $OpenBSD: userdel.8,v 1.18 2016/11/29 03:59:31 jsg Exp $
2.\" $NetBSD: userdel.8,v 1.24 2003/02/25 10:36:21 wiz Exp $
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. The name of the author may not be used to endorse or promote
15.\"    products derived from this software without specific prior written
16.\"    permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\"
31.Dd $Mdocdate: November 29 2016 $
32.Dt USERDEL 8
33.Os
34.Sh NAME
35.Nm userdel
36.Nd remove a user from the system
37.Sh SYNOPSIS
38.Nm userdel
39.Fl D
40.Op Fl p Ar preserve-value
41.Nm userdel
42.Op Fl rv
43.Op Fl p Ar preserve-value
44.Ar user
45.Sh DESCRIPTION
46The
47.Nm
48utility removes a user from the system, optionally
49removing that user's home directory and any subdirectories.
50.Pp
51Default values are taken from the information provided in the
52.Pa /etc/usermgmt.conf
53file, which, if running as root, is created using the built-in defaults if
54it does not exist.
55.Pp
56The first form of the command shown above (using the
57.Fl D
58option) sets and displays the defaults for the
59.Nm
60utility.
61.Bl -tag -width Ds
62.It Fl D
63Without any further options,
64.Fl D
65will show the current defaults which will be used by the
66.Nm
67utility.
68Together with one of the options shown for the first version
69of the command,
70.Fl D
71will set the default to be the new value.
72.It Fl p Ar preserve-value
73Sets the preservation value.
74If this value is one of
75.Ql true ,
76.Ql yes ,
77or a non-zero number, then the user login information will be preserved.
78.El
79.Pp
80In the second form of the command,
81after setting any defaults, and then reading values from
82.Pa /etc/usermgmt.conf ,
83the following command line options are processed:
84.Bl -tag -width Ds
85.It Fl p Ar preserve-value
86Preserve the user information in the password file,
87but do not allow the user to login, by switching the
88password to an
89.Dq impossible
90one, and by setting the
91user's shell to the
92.Xr nologin 8
93program.
94This option can be helpful in preserving a user's
95files for later use by members of that person's
96group after the user has moved on.
97This value can also be set in the
98.Pa /etc/usermgmt.conf
99file, using the
100.Ql preserve
101field.
102If the field has any of the values
103.Ql true ,
104.Ql yes ,
105or a non-zero number, then user information preservation will take place.
106.It Fl r
107Remove the user's home directory, any subdirectories,
108and any files and other entries in them.
109.It Fl v
110Perform any actions in a verbose manner.
111.El
112.Pp
113Once the information has been verified,
114.Nm
115uses
116.Xr pwd_mkdb 8
117to update the user database.
118This is run in the background and,
119at very large sites, could take several minutes.
120Until this update is completed, the password file is unavailable for other
121updates and the new information is not available to programs.
122.Sh FILES
123.Bl -tag -width /etc/usermgmt.conf -compact
124.It Pa /etc/usermgmt.conf
125.El
126.Sh EXIT STATUS
127.Ex -std userdel
128.Sh SEE ALSO
129.Xr passwd 5 ,
130.Xr usermgmt.conf 5 ,
131.Xr nologin 8 ,
132.Xr pwd_mkdb 8
133.Sh HISTORY
134The
135.Nm
136utility first appeared in
137.Ox 2.7 .
138.Sh AUTHORS
139The
140.Nm
141utility was written by
142.An Alistair G. Crooks Aq Mt agc@NetBSD.org .
143