xref: /openbsd-src/usr.sbin/user/userdel.8 (revision 7a3d14ecb20e7bd4167711f8dc52b019326d4275)
1*7a3d14ecSjsg.\" $OpenBSD: userdel.8,v 1.18 2016/11/29 03:59:31 jsg Exp $
26806f038Smillert.\" $NetBSD: userdel.8,v 1.24 2003/02/25 10:36:21 wiz Exp $
3e02380dbSjakob.\"
4e02380dbSjakob.\" Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
5e02380dbSjakob.\"
6e02380dbSjakob.\" Redistribution and use in source and binary forms, with or without
7e02380dbSjakob.\" modification, are permitted provided that the following conditions
8e02380dbSjakob.\" are met:
9e02380dbSjakob.\" 1. Redistributions of source code must retain the above copyright
10e02380dbSjakob.\"    notice, this list of conditions and the following disclaimer.
11e02380dbSjakob.\" 2. Redistributions in binary form must reproduce the above copyright
12e02380dbSjakob.\"    notice, this list of conditions and the following disclaimer in the
13e02380dbSjakob.\"    documentation and/or other materials provided with the distribution.
14*7a3d14ecSjsg.\" 3. The name of the author may not be used to endorse or promote
15e02380dbSjakob.\"    products derived from this software without specific prior written
16e02380dbSjakob.\"    permission.
17e02380dbSjakob.\"
18e02380dbSjakob.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19e02380dbSjakob.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20e02380dbSjakob.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21e02380dbSjakob.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22e02380dbSjakob.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23e02380dbSjakob.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24e02380dbSjakob.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25e02380dbSjakob.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26e02380dbSjakob.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27e02380dbSjakob.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28e02380dbSjakob.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29e02380dbSjakob.\"
30e02380dbSjakob.\"
31*7a3d14ecSjsg.Dd $Mdocdate: November 29 2016 $
32e02380dbSjakob.Dt USERDEL 8
338aa50653Sjakob.Os
34e02380dbSjakob.Sh NAME
35e02380dbSjakob.Nm userdel
36e02380dbSjakob.Nd remove a user from the system
37e02380dbSjakob.Sh SYNOPSIS
38f1bf55a6Sjakob.Nm userdel
393c76c7c0Smillert.Fl D
40e02380dbSjakob.Op Fl p Ar preserve-value
41f1bf55a6Sjakob.Nm userdel
42fe0353c0Sjmc.Op Fl rv
43fe0353c0Sjmc.Op Fl p Ar preserve-value
443c76c7c0Smillert.Ar user
45e02380dbSjakob.Sh DESCRIPTION
46e02380dbSjakobThe
47e02380dbSjakob.Nm
48e02380dbSjakobutility removes a user from the system, optionally
496806f038Smillertremoving that user's home directory and any subdirectories.
50e02380dbSjakob.Pp
516806f038SmillertDefault values are taken from the information provided in the
526806f038Smillert.Pa /etc/usermgmt.conf
536806f038Smillertfile, which, if running as root, is created using the built-in defaults if
546806f038Smillertit does not exist.
556806f038Smillert.Pp
566806f038SmillertThe first form of the command shown above (using the
576806f038Smillert.Fl D
586806f038Smillertoption) sets and displays the defaults for the
59e02380dbSjakob.Nm
60e02380dbSjakobutility.
61e02380dbSjakob.Bl -tag -width Ds
62e02380dbSjakob.It Fl D
630f5c715dSsobradoWithout any further options,
643c76c7c0Smillert.Fl D
653c76c7c0Smillertwill show the current defaults which will be used by the
66e02380dbSjakob.Nm
676806f038Smillertutility.
686806f038SmillertTogether with one of the options shown for the first version
693c76c7c0Smillertof the command,
703c76c7c0Smillert.Fl D
713c76c7c0Smillertwill set the default to be the new value.
72e02380dbSjakob.It Fl p Ar preserve-value
730f5c715dSsobradoSets the preservation value.
744fb31a24SjmcIf this value is one of
753c76c7c0Smillert.Ql true ,
763c76c7c0Smillert.Ql yes ,
77e02380dbSjakobor a non-zero number, then the user login information will be preserved.
78e02380dbSjakob.El
79e02380dbSjakob.Pp
806806f038SmillertIn the second form of the command,
816806f038Smillertafter setting any defaults, and then reading values from
826806f038Smillert.Pa /etc/usermgmt.conf ,
836806f038Smillertthe following command line options are processed:
84e02380dbSjakob.Bl -tag -width Ds
85fe0353c0Sjmc.It Fl p Ar preserve-value
860f5c715dSsobradoPreserve the user information in the password file,
87e02380dbSjakobbut do not allow the user to login, by switching the
883c76c7c0Smillertpassword to an
893c76c7c0Smillert.Dq impossible
903c76c7c0Smillertone, and by setting the
913c76c7c0Smillertuser's shell to the
926806f038Smillert.Xr nologin 8
934fb31a24Sjmcprogram.
944fb31a24SjmcThis option can be helpful in preserving a user's
95e02380dbSjakobfiles for later use by members of that person's
96e02380dbSjakobgroup after the user has moved on.
97e02380dbSjakobThis value can also be set in the
98e02380dbSjakob.Pa /etc/usermgmt.conf
993c76c7c0Smillertfile, using the
1003c76c7c0Smillert.Ql preserve
1014fb31a24Sjmcfield.
1024fb31a24SjmcIf the field has any of the values
1033c76c7c0Smillert.Ql true ,
1043c76c7c0Smillert.Ql yes ,
1053c76c7c0Smillertor a non-zero number, then user information preservation will take place.
106e02380dbSjakob.It Fl r
1070f5c715dSsobradoRemove the user's home directory, any subdirectories,
108e02380dbSjakoband any files and other entries in them.
109e02380dbSjakob.It Fl v
1100f5c715dSsobradoPerform any actions in a verbose manner.
111e02380dbSjakob.El
112e02380dbSjakob.Pp
1133c76c7c0SmillertOnce the information has been verified,
1143c76c7c0Smillert.Nm
1153c76c7c0Smillertuses
1163c76c7c0Smillert.Xr pwd_mkdb 8
1174fb31a24Sjmcto update the user database.
1180870f47dSjmcThis is run in the background and,
1190870f47dSjmcat very large sites, could take several minutes.
1204fb31a24SjmcUntil this update is completed, the password file is unavailable for other
1214fb31a24Sjmcupdates and the new information is not available to programs.
122e02380dbSjakob.Sh FILES
123e02380dbSjakob.Bl -tag -width /etc/usermgmt.conf -compact
124e02380dbSjakob.It Pa /etc/usermgmt.conf
125e02380dbSjakob.El
126741b6f30Sjmc.Sh EXIT STATUS
127741b6f30Sjmc.Ex -std userdel
128e02380dbSjakob.Sh SEE ALSO
1293c76c7c0Smillert.Xr passwd 5 ,
1306806f038Smillert.Xr usermgmt.conf 5 ,
1316806f038Smillert.Xr nologin 8 ,
1323c76c7c0Smillert.Xr pwd_mkdb 8
133e02380dbSjakob.Sh HISTORY
134e02380dbSjakobThe
135e02380dbSjakob.Nm
136e02380dbSjakobutility first appeared in
137f88889abSjakob.Ox 2.7 .
138b5667098Smpech.Sh AUTHORS
139e02380dbSjakobThe
140e02380dbSjakob.Nm
1416806f038Smillertutility was written by
14244e68d47Sschwarze.An Alistair G. Crooks Aq Mt agc@NetBSD.org .
143