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