xref: /dragonfly/usr.sbin/adduser/rmuser.8 (revision 9f3fc534)
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.\" $FreeBSD: src/usr.sbin/adduser/rmuser.8,v 1.25 2006/12/05 23:20:14 ceri Exp $
28.\" $DragonFly: src/usr.sbin/adduser/rmuser.8,v 1.5 2007/12/28 16:37:10 matthias Exp $
29.\"
30.Dd May 10, 2002
31.Dt RMUSER 8
32.Os
33.Sh NAME
34.Nm rmuser
35.Nd remove users from the system
36.Sh SYNOPSIS
37.Nm
38.Op Fl yv
39.Op Fl f Ar file
40.Op Ar username ...
41.Sh DESCRIPTION
42The
43.Nm
44utility removes one or more users submitted on the command line
45or from a file.
46In removing a user from the system, this utility:
47.Bl -enum
48.It
49Removes the user's
50.Xr crontab 1
51entry (if any).
52.It
53Removes any
54.Xr at 1
55jobs belonging to the user.
56.It
57Sends a
58.Dv SIGKILL
59signal to all processes owned by the user.
60.It
61Removes the user from the system's local password file.
62.It
63Removes the user's home directory (if it is owned by the user),
64including handling of symbolic links in the path to the actual home
65directory.
66.It
67Removes the incoming mail and POP daemon mail files belonging to the
68user from
69.Pa /var/mail .
70.It
71Removes all files owned by the user from
72.Pa /tmp , /var/tmp ,
73and
74.Pa /var/tmp/vi.recover .
75.It
76Removes the username from all groups to which it belongs in
77.Pa /etc/group .
78(If a group becomes empty and the group name is the same as the username,
79the group is removed; this complements
80.Xr adduser 8 Ns 's
81per-user unique groups.)
82.It
83Removes all message queues, shared memory segments and
84semaphores owned by the user.
85.El
86.Pp
87The
88.Nm
89utility refuses to remove users whose UID is 0 (typically root), since
90certain actions (namely, killing all the user's processes, and perhaps
91removing the user's home directory) would cause damage to a running system.
92If it is necessary to remove a user whose UID is 0, see
93.Xr vipw 8
94for information on directly editing the password file.
95.Pp
96If
97.Nm
98was not invoked with the
99.Fl y
100option, it will
101show the selected user's password file entry and ask for confirmation
102that the user be removed.
103It will then ask for confirmation to delete
104the user's home directory.
105If the answer is in the affirmative, the home
106directory and any files and subdirectories under it will be deleted only if
107they are owned by the user.
108See
109.Xr pw 8
110for more details.
111.Pp
112As
113.Nm
114operates, it informs the user regarding the current activity.
115If any
116errors occur, they are posted to standard error and, if it is possible for
117.Nm
118to continue, it will.
119.Pp
120The options are as follows:
121.Bl -tag -width ".Ar username"
122.It Fl f Ar file
123The
124.Nm
125utility will get a list of users to be removed from
126.Ar file ,
127which will contain one user per line.
128Anything following a hash mark
129.Pq Ql # ,
130including the hash mark itself, is considered a comment and will not
131be processed.
132If the file is owned by anyone other than a user with
133UID 0, or is writable by anyone other than the owner,
134.Nm
135will refuse to continue.
136.It Fl y
137Implicitly answer
138.Dq Li yes
139to any and all prompts.
140Currently, this includes
141prompts on whether to remove the specified user and whether to remove
142the home directory.
143This option requires that either the
144.Fl f
145option be used, or one or more user names be given as command line
146arguments.
147.It Fl v
148Enable verbose mode.
149Normally,
150the output includes one line per removed user;
151however,
152with this option
153.Nm
154will be much more chatty about the steps taken.
155.It Ar username
156Identifies one or more users to be removed; if not present,
157.Nm
158interactively asks for one or more users to be removed.
159.El
160.Sh FILES
161.Bl -tag -compact
162.It Pa /etc/master.passwd
163.It Pa /etc/passwd
164.It Pa /etc/group
165.It Pa /etc/spwd.db
166.It Pa /etc/pwd.db
167.El
168.Sh SEE ALSO
169.Xr at 1 ,
170.Xr chpass 1 ,
171.Xr crontab 1 ,
172.Xr finger 1 ,
173.Xr passwd 1 ,
174.Xr group 5 ,
175.Xr passwd 5 ,
176.Xr adduser 8 ,
177.Xr pw 8 ,
178.Xr pwd_mkdb 8 ,
179.Xr vipw 8
180.Sh HISTORY
181The
182.Nm
183utility appeared in
184.Fx 2.2 .
185.Sh BUGS
186The
187.Nm
188utility does not comprehensively search the file system for all files
189owned by the removed user and remove them; to do so on a system
190of any size is prohibitively slow and I/O intensive.
191It is also unable to remove symbolic links that were created by the
192user in
193.Pa /tmp
194or
195.Pa /var/tmp ,
196as symbolic links on
197.Bx 4.4
198file systems do not contain information
199as to who created them.
200Also, there may be other files created in
201.Pa /var/mail
202other than
203.Pa /var/mail/ Ns Ar username
204and
205.Pa /var/mail/.pop. Ns Ar username
206that are not owned by the removed user but should be removed.
207.Pp
208The
209.Nm
210utility has no knowledge of YP/NIS, and it operates only on the
211local password file.
212