xref: /freebsd/usr.sbin/adduser/rmuser.8 (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1.\" Copyright 1995, 1996, 1997
2.\"     Guy Helmer, Ames, Iowa 50014.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer as
9.\"    the first lines of this file unmodified.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. The name of the author may not be used to endorse or promote products
14.\"    derived from this software without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY GUY HELMER ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL GUY HELMER BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd May 10, 2002
28.Dt RMUSER 8
29.Os
30.Sh NAME
31.Nm rmuser
32.Nd remove users from the system
33.Sh SYNOPSIS
34.Nm
35.Op Fl yv
36.Op Fl f Ar file
37.Op Ar username ...
38.Sh DESCRIPTION
39The
40.Nm
41utility removes one or more users submitted on the command line
42or from a file.
43In removing a user from the system, this utility:
44.Bl -enum
45.It
46Removes the user's
47.Xr crontab 1
48entry (if any).
49.It
50Removes any
51.Xr at 1
52jobs belonging to the user.
53.It
54Sends a
55.Dv SIGKILL
56signal to all processes owned by the user.
57.It
58Removes the user from the system's local password file.
59.It
60Removes the user's home directory (if it is owned by the user),
61including handling of symbolic links in the path to the actual home
62directory.
63.It
64Removes the incoming mail and POP daemon mail files belonging to the
65user from
66.Pa /var/mail .
67.It
68Removes all files owned by the user from
69.Pa /tmp , /var/tmp ,
70and
71.Pa /var/tmp/vi.recover .
72.It
73Removes the username from all groups to which it belongs in
74.Pa /etc/group .
75(If a group becomes empty and the group name is the same as the username,
76the group is removed; this complements
77.Xr adduser 8 Ns 's
78per-user unique groups.)
79.It
80Removes all message queues, shared memory segments and
81semaphores owned by the user.
82.El
83.Pp
84The
85.Nm
86utility refuses to remove users whose UID is 0 (typically root), since
87certain actions (namely, killing all the user's processes, and perhaps
88removing the user's home directory) would cause damage to a running system.
89If it is necessary to remove a user whose UID is 0, see
90.Xr vipw 8
91for information on directly editing the password file.
92.Pp
93If
94.Nm
95was not invoked with the
96.Fl y
97option, it will
98show the selected user's password file entry and ask for confirmation
99that the user be removed.
100It will then ask for confirmation to delete
101the user's home directory.
102If the answer is in the affirmative, the home
103directory and any files and subdirectories under it will be deleted only if
104they are owned by the user.
105See
106.Xr pw 8
107for more details.
108.Pp
109As
110.Nm
111operates, it informs the user regarding the current activity.
112If any
113errors occur, they are posted to standard error and, if it is possible for
114.Nm
115to continue, it will.
116.Pp
117The options are as follows:
118.Bl -tag -width ".Ar username"
119.It Fl f Ar file
120The
121.Nm
122utility will get a list of users to be removed from
123.Ar file ,
124which will contain one user per line.
125Anything following a hash mark
126.Pq Ql # ,
127including the hash mark itself, is considered a comment and will not
128be processed.
129If the file is owned by anyone other than a user with
130UID 0, or is writable by anyone other than the owner,
131.Nm
132will refuse to continue.
133.It Fl y
134Implicitly answer
135.Dq Li yes
136to any and all prompts.
137Currently, this includes
138prompts on whether to remove the specified user and whether to remove
139the home directory.
140This option requires that either the
141.Fl f
142option be used, or one or more user names be given as command line
143arguments.
144.It Fl v
145Enable verbose mode.
146Normally,
147the output includes one line per removed user;
148however,
149with this option
150.Nm
151will be much more chatty about the steps taken.
152.It Ar username
153Identifies one or more users to be removed; if not present,
154.Nm
155interactively asks for one or more users to be removed.
156.El
157.Sh FILES
158.Bl -tag -width "Pa /etc/master.passwd" -compact
159.It Pa /etc/master.passwd
160.It Pa /etc/passwd
161.It Pa /etc/group
162.It Pa /etc/spwd.db
163.It Pa /etc/pwd.db
164.El
165.Sh SEE ALSO
166.Xr at 1 ,
167.Xr chpass 1 ,
168.Xr crontab 1 ,
169.Xr finger 1 ,
170.Xr passwd 1 ,
171.Xr group 5 ,
172.Xr passwd 5 ,
173.Xr adduser 8 ,
174.Xr pw 8 ,
175.Xr pwd_mkdb 8 ,
176.Xr vipw 8
177.Sh HISTORY
178The
179.Nm
180utility appeared in
181.Fx 2.2 .
182.Sh BUGS
183The
184.Nm
185utility does not comprehensively search the file system for all files
186owned by the removed user and remove them; to do so on a system
187of any size is prohibitively slow and I/O intensive.
188It is also unable to remove symbolic links that were created by the
189user in
190.Pa /tmp
191or
192.Pa /var/tmp ,
193as symbolic links on
194.Bx 4.4
195file systems do not contain information
196as to who created them.
197Also, there may be other files created in
198.Pa /var/mail
199other than
200.Pa /var/mail/ Ns Ar username
201and
202.Pa /var/mail/.pop. Ns Ar username
203that are not owned by the removed user but should be removed.
204.Pp
205The
206.Nm
207utility has no knowledge of YP/NIS, and it operates only on the
208local password file.
209