xref: /freebsd/usr.sbin/adduser/rmuser.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
11e85e4dbSWolfram Schneider.\" Copyright 1995, 1996, 1997
21e85e4dbSWolfram Schneider.\"     Guy Helmer, Ames, Iowa 50014.  All rights reserved.
3901c028eSWolfram Schneider.\"
4901c028eSWolfram Schneider.\" Redistribution and use in source and binary forms, with or without
5901c028eSWolfram Schneider.\" modification, are permitted provided that the following conditions
6901c028eSWolfram Schneider.\" are met:
7901c028eSWolfram Schneider.\" 1. Redistributions of source code must retain the above copyright
8901c028eSWolfram Schneider.\"    notice, this list of conditions and the following disclaimer as
9901c028eSWolfram Schneider.\"    the first lines of this file unmodified.
10901c028eSWolfram Schneider.\" 2. Redistributions in binary form must reproduce the above copyright
11901c028eSWolfram Schneider.\"    notice, this list of conditions and the following disclaimer in the
12901c028eSWolfram Schneider.\"    documentation and/or other materials provided with the distribution.
13901c028eSWolfram Schneider.\" 3. The name of the author may not be used to endorse or promote products
14901c028eSWolfram Schneider.\"    derived from this software without specific prior written permission.
15901c028eSWolfram Schneider.\"
16901c028eSWolfram Schneider.\" THIS SOFTWARE IS PROVIDED BY GUY HELMER ``AS IS'' AND ANY EXPRESS OR
17901c028eSWolfram Schneider.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18901c028eSWolfram Schneider.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19901c028eSWolfram Schneider.\" IN NO EVENT SHALL GUY HELMER BE LIABLE FOR ANY DIRECT, INDIRECT,
20901c028eSWolfram Schneider.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21901c028eSWolfram Schneider.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22901c028eSWolfram Schneider.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23901c028eSWolfram Schneider.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24901c028eSWolfram Schneider.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25901c028eSWolfram Schneider.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26901c028eSWolfram Schneider.\"
277cdfce09SScott Long.Dd May 10, 2002
28901c028eSWolfram Schneider.Dt RMUSER 8
29901c028eSWolfram Schneider.Os
30901c028eSWolfram Schneider.Sh NAME
31901c028eSWolfram Schneider.Nm rmuser
32829629feSRuslan Ermilov.Nd remove users from the system
33901c028eSWolfram Schneider.Sh SYNOPSIS
34e97407b4SRuslan Ermilov.Nm
35ace5be68SRuslan Ermilov.Op Fl yv
367cdfce09SScott Long.Op Fl f Ar file
377cdfce09SScott Long.Op Ar username ...
38901c028eSWolfram Schneider.Sh DESCRIPTION
39490d5836SPhilippe CharnierThe
40b8594fe0SPhilippe Charnier.Nm
417cdfce09SScott Longutility removes one or more users submitted on the command line
42829629feSRuslan Ermilovor from a file.
43829629feSRuslan ErmilovIn removing a user from the system, this utility:
441e85e4dbSWolfram Schneider.Bl -enum
451e85e4dbSWolfram Schneider.It
461e85e4dbSWolfram SchneiderRemoves the user's
47901c028eSWolfram Schneider.Xr crontab 1
48b8594fe0SPhilippe Charnierentry (if any).
491e85e4dbSWolfram Schneider.It
501e85e4dbSWolfram SchneiderRemoves any
51901c028eSWolfram Schneider.Xr at 1
52b8594fe0SPhilippe Charnierjobs belonging to the user.
531e85e4dbSWolfram Schneider.It
54829629feSRuslan ErmilovSends a
55829629feSRuslan Ermilov.Dv SIGKILL
56829629feSRuslan Ermilovsignal to all processes owned by the user.
571e85e4dbSWolfram Schneider.It
58b8594fe0SPhilippe CharnierRemoves the user from the system's local password file.
591e85e4dbSWolfram Schneider.It
601e85e4dbSWolfram SchneiderRemoves the user's home directory (if it is owned by the user),
611e85e4dbSWolfram Schneiderincluding handling of symbolic links in the path to the actual home
62b8594fe0SPhilippe Charnierdirectory.
631e85e4dbSWolfram Schneider.It
64829629feSRuslan ErmilovRemoves the incoming mail and POP daemon mail files belonging to the
651e85e4dbSWolfram Schneideruser from
66b8594fe0SPhilippe Charnier.Pa /var/mail .
671e85e4dbSWolfram Schneider.It
681e85e4dbSWolfram SchneiderRemoves all files owned by the user from
69829629feSRuslan Ermilov.Pa /tmp , /var/tmp ,
701e85e4dbSWolfram Schneiderand
711e85e4dbSWolfram Schneider.Pa /var/tmp/vi.recover .
721e85e4dbSWolfram Schneider.It
731e85e4dbSWolfram SchneiderRemoves the username from all groups to which it belongs in
74901c028eSWolfram Schneider.Pa /etc/group .
751e85e4dbSWolfram Schneider(If a group becomes empty and the group name is the same as the username,
761e85e4dbSWolfram Schneiderthe group is removed; this complements
771bfea903SRuslan Ermilov.Xr adduser 8 Ns 's
78829629feSRuslan Ermilovper-user unique groups.)
793d2f5612SChristian S.J. Peron.It
803d2f5612SChristian S.J. PeronRemoves all message queues, shared memory segments and
813d2f5612SChristian S.J. Peronsemaphores owned by the user.
821e85e4dbSWolfram Schneider.El
83901c028eSWolfram Schneider.Pp
84490d5836SPhilippe CharnierThe
85490d5836SPhilippe Charnier.Nm
86829629feSRuslan Ermilovutility refuses to remove users whose UID is 0 (typically root), since
871e85e4dbSWolfram Schneidercertain actions (namely, killing all the user's processes, and perhaps
881e85e4dbSWolfram Schneiderremoving the user's home directory) would cause damage to a running system.
89829629feSRuslan ErmilovIf it is necessary to remove a user whose UID is 0, see
901e85e4dbSWolfram Schneider.Xr vipw 8
91829629feSRuslan Ermilovfor information on directly editing the password file.
92901c028eSWolfram Schneider.Pp
937cdfce09SScott LongIf
947cdfce09SScott Long.Nm
957cdfce09SScott Longwas not invoked with the
961e85e4dbSWolfram Schneider.Fl y
97829629feSRuslan Ermilovoption, it will
987cdfce09SScott Longshow the selected user's password file entry and ask for confirmation
99829629feSRuslan Ermilovthat the user be removed.
100829629feSRuslan ErmilovIt will then ask for confirmation to delete
101829629feSRuslan Ermilovthe user's home directory.
102829629feSRuslan ErmilovIf the answer is in the affirmative, the home
1037cdfce09SScott Longdirectory and any files and subdirectories under it will be deleted only if
104829629feSRuslan Ermilovthey are owned by the user.
105829629feSRuslan ErmilovSee
1067cdfce09SScott Long.Xr pw 8
1077cdfce09SScott Longfor more details.
108901c028eSWolfram Schneider.Pp
1091e85e4dbSWolfram SchneiderAs
110b8594fe0SPhilippe Charnier.Nm
111829629feSRuslan Ermilovoperates, it informs the user regarding the current activity.
112829629feSRuslan ErmilovIf any
1131e85e4dbSWolfram Schneidererrors occur, they are posted to standard error and, if it is possible for
114b8594fe0SPhilippe Charnier.Nm
1151e85e4dbSWolfram Schneiderto continue, it will.
1161e85e4dbSWolfram Schneider.Pp
117829629feSRuslan ErmilovThe options are as follows:
118829629feSRuslan Ermilov.Bl -tag -width ".Ar username"
119829629feSRuslan Ermilov.It Fl f Ar file
1207cdfce09SScott LongThe
121b8594fe0SPhilippe Charnier.Nm
1227cdfce09SScott Longutility will get a list of users to be removed from
1237cdfce09SScott Long.Ar file ,
124829629feSRuslan Ermilovwhich will contain one user per line.
125829629feSRuslan ErmilovAnything following a hash mark
126829629feSRuslan Ermilov.Pq Ql # ,
1277cdfce09SScott Longincluding the hash mark itself, is considered a comment and will not
128829629feSRuslan Ermilovbe processed.
129829629feSRuslan ErmilovIf the file is owned by anyone other than a user with
1303f61998eSCeri DaviesUID 0, or is writable by anyone other than the owner,
1317cdfce09SScott Long.Nm
1327cdfce09SScott Longwill refuse to continue.
133829629feSRuslan Ermilov.It Fl y
134829629feSRuslan ErmilovImplicitly answer
135829629feSRuslan Ermilov.Dq Li yes
136829629feSRuslan Ermilovto any and all prompts.
137829629feSRuslan ErmilovCurrently, this includes
138829629feSRuslan Ermilovprompts on whether to remove the specified user and whether to remove
139829629feSRuslan Ermilovthe home directory.
140829629feSRuslan ErmilovThis option requires that either the
141829629feSRuslan Ermilov.Fl f
14257bd0fc6SJens Schweikhardtoption be used, or one or more user names be given as command line
143829629feSRuslan Ermilovarguments.
144ace5be68SRuslan Ermilov.It Fl v
145ace5be68SRuslan ErmilovEnable verbose mode.
146ace5be68SRuslan ErmilovNormally,
147b3bd9a17SCeri Daviesthe output includes one line per removed user;
148ace5be68SRuslan Ermilovhowever,
149ace5be68SRuslan Ermilovwith this option
150ace5be68SRuslan Ermilov.Nm
151ace5be68SRuslan Ermilovwill be much more chatty about the steps taken.
152829629feSRuslan Ermilov.It Ar username
1537cdfce09SScott LongIdentifies one or more users to be removed; if not present,
1547cdfce09SScott Long.Nm
1557cdfce09SScott Longinteractively asks for one or more users to be removed.
1568b5c4af3SRuslan Ermilov.El
157901c028eSWolfram Schneider.Sh FILES
158*e1656a88SJoel Dahl.Bl -tag -width "Pa /etc/master.passwd" -compact
159901c028eSWolfram Schneider.It Pa /etc/master.passwd
160901c028eSWolfram Schneider.It Pa /etc/passwd
161901c028eSWolfram Schneider.It Pa /etc/group
162901c028eSWolfram Schneider.It Pa /etc/spwd.db
163901c028eSWolfram Schneider.It Pa /etc/pwd.db
164901c028eSWolfram Schneider.El
165901c028eSWolfram Schneider.Sh SEE ALSO
166901c028eSWolfram Schneider.Xr at 1 ,
167901c028eSWolfram Schneider.Xr chpass 1 ,
168901c028eSWolfram Schneider.Xr crontab 1 ,
169901c028eSWolfram Schneider.Xr finger 1 ,
170901c028eSWolfram Schneider.Xr passwd 1 ,
171901c028eSWolfram Schneider.Xr group 5 ,
172901c028eSWolfram Schneider.Xr passwd 5 ,
173bfd34a4aSWolfram Schneider.Xr adduser 8 ,
1747cdfce09SScott Long.Xr pw 8 ,
175901c028eSWolfram Schneider.Xr pwd_mkdb 8 ,
176901c028eSWolfram Schneider.Xr vipw 8
177901c028eSWolfram Schneider.Sh HISTORY
178901c028eSWolfram SchneiderThe
179901c028eSWolfram Schneider.Nm
180829629feSRuslan Ermilovutility appeared in
1811e85e4dbSWolfram Schneider.Fx 2.2 .
1821e85e4dbSWolfram Schneider.Sh BUGS
183490d5836SPhilippe CharnierThe
184490d5836SPhilippe Charnier.Nm
185490d5836SPhilippe Charnierutility does not comprehensively search the file system for all files
1861e85e4dbSWolfram Schneiderowned by the removed user and remove them; to do so on a system
1871e85e4dbSWolfram Schneiderof any size is prohibitively slow and I/O intensive.
1887cdfce09SScott LongIt is also unable to remove symbolic links that were created by the
1891e85e4dbSWolfram Schneideruser in
1901e85e4dbSWolfram Schneider.Pa /tmp
1911e85e4dbSWolfram Schneideror
192829629feSRuslan Ermilov.Pa /var/tmp ,
193753d686dSRuslan Ermilovas symbolic links on
194753d686dSRuslan Ermilov.Bx 4.4
195753d686dSRuslan Ermilovfile systems do not contain information
196829629feSRuslan Ermilovas to who created them.
197829629feSRuslan ErmilovAlso, there may be other files created in
1981e85e4dbSWolfram Schneider.Pa /var/mail
1991e85e4dbSWolfram Schneiderother than
200829629feSRuslan Ermilov.Pa /var/mail/ Ns Ar username
2011e85e4dbSWolfram Schneiderand
202829629feSRuslan Ermilov.Pa /var/mail/.pop. Ns Ar username
2031e85e4dbSWolfram Schneiderthat are not owned by the removed user but should be removed.
2041e85e4dbSWolfram Schneider.Pp
205490d5836SPhilippe CharnierThe
206490d5836SPhilippe Charnier.Nm
207829629feSRuslan Ermilovutility has no knowledge of YP/NIS, and it operates only on the
2081e85e4dbSWolfram Schneiderlocal password file.
209