xref: /openbsd/usr.sbin/user/userdel.8 (revision cecf84d4)
1.\" $OpenBSD: userdel.8,v 1.17 2015/03/13 19:58:41 jmc 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. 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 $Mdocdate: March 13 2015 $
35.Dt USERDEL 8
36.Os
37.Sh NAME
38.Nm userdel
39.Nd remove a user from the system
40.Sh SYNOPSIS
41.Nm userdel
42.Fl D
43.Op Fl p Ar preserve-value
44.Nm userdel
45.Op Fl rv
46.Op Fl p Ar preserve-value
47.Ar user
48.Sh DESCRIPTION
49The
50.Nm
51utility removes a user from the system, optionally
52removing that user's home directory and any subdirectories.
53.Pp
54Default values are taken from the information provided in the
55.Pa /etc/usermgmt.conf
56file, which, if running as root, is created using the built-in defaults if
57it does not exist.
58.Pp
59The first form of the command shown above (using the
60.Fl D
61option) sets and displays the defaults for the
62.Nm
63utility.
64.Bl -tag -width Ds
65.It Fl D
66Without any further options,
67.Fl D
68will show the current defaults which will be used by the
69.Nm
70utility.
71Together with one of the options shown for the first version
72of the command,
73.Fl D
74will set the default to be the new value.
75.It Fl p Ar preserve-value
76Sets the preservation value.
77If this value is one of
78.Ql true ,
79.Ql yes ,
80or a non-zero number, then the user login information will be preserved.
81.El
82.Pp
83In the second form of the command,
84after setting any defaults, and then reading values from
85.Pa /etc/usermgmt.conf ,
86the following command line options are processed:
87.Bl -tag -width Ds
88.It Fl p Ar preserve-value
89Preserve the user information in the password file,
90but do not allow the user to login, by switching the
91password to an
92.Dq impossible
93one, and by setting the
94user's shell to the
95.Xr nologin 8
96program.
97This option can be helpful in preserving a user's
98files for later use by members of that person's
99group after the user has moved on.
100This value can also be set in the
101.Pa /etc/usermgmt.conf
102file, using the
103.Ql preserve
104field.
105If the field has any of the values
106.Ql true ,
107.Ql yes ,
108or a non-zero number, then user information preservation will take place.
109.It Fl r
110Remove the user's home directory, any subdirectories,
111and any files and other entries in them.
112.It Fl v
113Perform any actions in a verbose manner.
114.El
115.Pp
116Once the information has been verified,
117.Nm
118uses
119.Xr pwd_mkdb 8
120to update the user database.
121This is run in the background and,
122at very large sites, could take several minutes.
123Until this update is completed, the password file is unavailable for other
124updates and the new information is not available to programs.
125.Sh FILES
126.Bl -tag -width /etc/usermgmt.conf -compact
127.It Pa /etc/usermgmt.conf
128.El
129.Sh EXIT STATUS
130.Ex -std userdel
131.Sh SEE ALSO
132.Xr passwd 5 ,
133.Xr usermgmt.conf 5 ,
134.Xr nologin 8 ,
135.Xr pwd_mkdb 8
136.Sh HISTORY
137The
138.Nm
139utility first appeared in
140.Ox 2.7 .
141.Sh AUTHORS
142The
143.Nm
144utility was written by
145.An Alistair G. Crooks Aq Mt agc@NetBSD.org .
146