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