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