summaryrefslogtreecommitdiffstats
path: root/doc/deluser.8
blob: 04251fbcb650396f95478502b8b6ffb5d493e6da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
.\" Someone tell emacs that this is an -*- nroff -*- source file.
.\" Copyright 1997, 1998, 1999 Guy Maor.
.\" Adduser and this manpage are copyright 1995 by Ted Hajek,
.\" With much borrowing from the original adduser copyright 1994 by
.\" Ian Murdock.
.\" 
.\" This is free software; see the GNU General Public License version
.\" 2 or later for copying conditions.  There is NO warranty.
.TH DELUSER 8 "Version VERSION" "Debian GNU/Linux"
.SH NAME
deluser, delgroup \- remove a user or group from the system
.SH SYNOPSIS
.BR deluser " [options] [\-\-force] [\-\-remove-home] [\-\-remove-all-files] [\-\-backup] [\-\-backup-to DIR] user"
.PP
.BR deluser " \-\-group [options] group"
.br
.BR delgroup " [options] [\-\-only-if-empty] group"
.PP
.BR deluser " [options] user group"
.SS COMMON OPTIONS
.br
[\-\-quiet] [\-\-system] [\-\-help] [\-\-version] [\-\-conf FILE]
.SH DESCRIPTION
.PP
.BR deluser " and " delgroup
remove users and groups from the system according to command line options
and configuration information in
.IR /etc/deluser.conf 
and
.IR /etc/adduser.conf .
They are friendlier front ends to the
.BR userdel " and " groupdel
programs, removing the home directory as option or even all files on the system
owned by the user to be removed, running a custom script, and other features.
.BR deluser " and " delgroup
can be run in one of three modes:
.SS "Remove a normal user"
If called with one non-option argument and without the
.BR \-\-group " option, " deluser
will remove a normal user.

By default,
.B deluser
will remove the user without removing the home directory, the mail spool  or
any other files on the system owned by the user. Removing the home directory
and mail spool can be achieved using the
.B \-\-remove-home
option. 

The 
.B \-\-remove-all-files
option removes all files on the system owned by the user. Note that if
you activate both options
.B \-\-remove-home
will have no effect because all files including the home directory and mail
spool are already covered by the
.B \-\-remove-all-files
option.

If you want to backup all files before deleting them you can activate the
.B \-\-backup
option which will create a file username.tar(.gz|.bz2) in the
directory specified by the
.B \-\-backup-to
option (defaulting to the current working directory). Both the remove
and backup options can also be activated for default in the configuration
file /etc/deluser.conf. See
.B deluser.conf(5)
for details.

If you want to remove the root account (uid 0), then use the 
.B \-\-force 
parameter; this may prevent to remove the root user by accident.

If the file
.B /usr/local/sbin/deluser.local
exists, it will be executed after the user account has been removed
in order to do any local cleanup. The arguments passed to
.B deluser.local
are:
.br
username uid gid home-directory

.SS "Remove a group"
If 
.BR deluser " is called with the " \-\-group " option, or " delgroup
is called, a group will be removed.

Warning: The primary group of an existing user cannot be removed.

If the option
.B \-\-only-if-empty
is given, the group won't be removed if it has any members left.

.SS "Remove a user from a specific group"
If called with two non-option arguments,
.B deluser
will remove a user from a specific group.
.SH OPTIONS
.TP
.B \-\-conf FILE
Use FILE instead of the default files
.IR /etc/deluser.conf
and
.IR /etc/adduser.conf
.TP
.B \-\-group
Remove a group. This is the default action if the program is invoked
as
.IR delgroup .
.TP
.B \-\-help
Display brief instructions.
.TP
.B \-\-quiet
Suppress progress messages.
.TP
.B \-\-system
Only delete if user/group is a system user/group. This avoids
accidentally deleting non-system users/groups. Additionally, if the
user does not exist, no error value is returned. This option is mainly
for use in Debian package maintainer scripts.
.TP
.B \-\-only-if-empty 
Only remove if no members are left.
.TP
.B \-\-backup
Backup all files contained in the userhome and the mailspool-file to a file named
/$user.tar.bz2 or /$user.tar.gz.
.TP
.B \-\-backup-to
Place the backup files not in / but in the directory specified by this parameter. This implicitly sets --backup also.
.TP
.B \-\-remove-home
Remove the home directory of the user and its mailspool. If \-\-backup is specified,
the files are deleted after having performed the backup.
.TP
.B \-\-remove-all-files
Remove all files from the system owned by this user. Note: \-\-remove-home does
not have an effect any more. If \-\-backup is specified, the files are deleted after
having performed the backup.
.TP
.B \-\-version
Display version and copyright information.
.SH "RETURN VALUE"
.TP
.B 0
The action was successfully executed.
.TP
.B 1
The user to delete was not a system account. No action was performed.
.TP
.B 2
There is no such user. No action was performed.
.TP
.B 3
There is no such group. No action was performed.
.TP
.B 4
Internal error. No action was performed.
.TP
.B 5
The group to delete is not empty. No action was performed.
.TP
.B 6
The user does not belong to the specified group. No action was performed.
.TP
.B 7
You cannot remove a user from its primary group. No action was performed.
.TP
.B 8
The required perl-package 'perl modules' is not installed. This package is required to perform the requested actions. No action was performed.
.TP
.B 9
For removing the root account the parameter "--force" is required. No action was performed.

.SH FILES
.IR /etc/deluser.conf
Default configuration file for deluser and delgroup
.TP
.IR /usr/local/sbin/deluser.local
Optional custom add-ons.

.SH "SEE ALSO"
.BR adduser (8),
.BR deluser.conf (5),
.BR groupdel (8),
.BR userdel (8) 

.SH COPYRIGHT
Copyright (C) 2000 Roland Bauerschmidt. Modifications (C) 2004
Marc Haber and Joerg Hoh.
This manpage and the deluser program are based on adduser which is:
.br
Copyright (C) 1997, 1998, 1999 Guy Maor.
.br
Copyright (C) 1995 Ted Hajek, with a great deal borrowed from the original
Debian 
.B adduser
.br
Copyright (C) 1994 Ian Murdock.
.B deluser
is free software; see the GNU General Public Licence version 2 or
later for copying conditions.  There is
.I no
warranty.