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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
'\" t
.\" Title: userdel
.\" Author: Julianne Frances Haugh
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 23-01-2020
.\" Manual: Systemhanteringskommandon
.\" Source: shadow-utils 4.8.1
.\" Language: Swedish
.\"
.TH "USERDEL" "8" "23-01-2020" "shadow\-utils 4\&.8\&.1" "Systemhanteringskommandon"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAMN"
userdel \- ta bort ett anv\(:andarkonto och relaterade filer
.SH "SYNOPSIS"
.HP \w'\fBuserdel\fR\ 'u
\fBuserdel\fR [flaggor] \fIINLOGGNINGSNAMN\fR
.SH "BESKRIVNING"
.PP
The
\fBuserdel\fR
command modifies the system account files, deleting all entries that refer to the user name
\fILOGIN\fR\&. The named user must exist\&.
.SH "FLAGGOR"
.PP
The options which apply to the
\fBuserdel\fR
command are:
.PP
\fB\-f\fR, \fB\-\-force\fR
.RS 4
This option forces the removal of the user account, even if the user is still logged in\&. It also forces
\fBuserdel\fR
to remove the user\*(Aqs home directory and mail spool, even if another user uses the same home directory or if the mail spool is not owned by the specified user\&. If
\fBUSERGROUPS_ENAB\fR
is defined to
\fIyes\fR
in
/etc/login\&.defs
and if a group exists with the same name as the deleted user, then this group will be removed, even if it is still the primary group of another user\&.
.sp
\fINote:\fR
This option is dangerous and may leave your system in an inconsistent state\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Visa hj\(:alpmeddelande och avsluta\&.
.RE
.PP
\fB\-r\fR, \fB\-\-remove\fR
.RS 4
Files in the user\*(Aqs home directory will be removed along with the home directory itself and the user\*(Aqs mail spool\&. Files located in other file systems will have to be searched for and deleted manually\&.
.sp
The mail spool is defined by the
\fBMAIL_DIR\fR
variable in the
login\&.defs
file\&.
.RE
.PP
\fB\-R\fR, \fB\-\-root\fR\ \&\fICHROOT_DIR\fR
.RS 4
Apply changes in the
\fICHROOT_DIR\fR
directory and use the configuration files from the
\fICHROOT_DIR\fR
directory\&.
.RE
.PP
\fB\-P\fR, \fB\-\-prefix\fR\ \&\fIPREFIX_DIR\fR
.RS 4
Apply changes in the
\fIPREFIX_DIR\fR
directory and use the configuration files from the
\fIPREFIX_DIR\fR
directory\&. This option does not chroot and is intended for preparing a cross\-compilation target\&. Some limitations: NIS and LDAP users/groups are not verified\&. PAM authentication is using the host files\&. No SELINUX support\&.
.RE
.PP
\fB\-Z\fR, \fB\-\-selinux\-user\fR
.RS 4
Remove any SELinux user mapping for the user\*(Aqs login\&.
.RE
.SH "CONFIGURATION"
.PP
The following configuration variables in
/etc/login\&.defs
change the behavior of this tool:
.PP
\fBMAIL_DIR\fR (string)
.RS 4
The mail spool directory\&. This is needed to manipulate the mailbox when its corresponding user account is modified or deleted\&. If not specified, a compile\-time default is used\&.
.RE
.PP
\fBMAIL_FILE\fR (string)
.RS 4
Defines the location of the users mail spool files relatively to their home directory\&.
.RE
.PP
The
\fBMAIL_DIR\fR
and
\fBMAIL_FILE\fR
variables are used by
\fBuseradd\fR,
\fBusermod\fR, and
\fBuserdel\fR
to create, move, or delete the user\*(Aqs mail spool\&.
.PP
If
\fBMAIL_CHECK_ENAB\fR
is set to
\fIyes\fR, they are also used to define the
\fBMAIL\fR
environment variable\&.
.PP
\fBMAX_MEMBERS_PER_GROUP\fR (number)
.RS 4
Maximum members per group entry\&. When the maximum is reached, a new group entry (line) is started in
/etc/group
(with the same name, same password, and same GID)\&.
.sp
The default value is 0, meaning that there are no limits in the number of members in a group\&.
.sp
This feature (split group) permits to limit the length of lines in the group file\&. This is useful to make sure that lines for NIS groups are not larger than 1024 characters\&.
.sp
If you need to enforce such limit, you can use 25\&.
.sp
Note: split groups may not be supported by all tools (even in the Shadow toolsuite)\&. You should not use this variable unless you really need it\&.
.RE
.PP
\fBUSERDEL_CMD\fR (string)
.RS 4
If defined, this command is run when removing a user\&. It should remove any at/cron/print jobs etc\&. owned by the user to be removed (passed as the first argument)\&.
.sp
The return code of the script is not taken into account\&.
.sp
Here is an example script, which removes the user\*(Aqs cron, at and print jobs:
.sp
.if n \{\
.RS 4
.\}
.nf
#! /bin/sh
# Check for the required argument\&.
if [ $# != 1 ]; then
echo "Usage: $0 username"
exit 1
fi
# Remove cron jobs\&.
crontab \-r \-u $1
# Remove at jobs\&.
# Note that it will remove any jobs owned by the same UID,
# even if it was shared by a different username\&.
AT_SPOOL_DIR=/var/spool/cron/atjobs
find $AT_SPOOL_DIR \-name "[^\&.]*" \-type f \-user $1 \-delete \e;
# Remove print jobs\&.
lprm $1
# All done\&.
exit 0
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
\fBUSERGROUPS_ENAB\fR (boolean)
.RS 4
Enable setting of the umask group bits to be the same as owner bits (examples: 022 \-> 002, 077 \-> 007) for non\-root users, if the uid is the same as gid, and username is the same as the primary group name\&.
.sp
If set to
\fIyes\fR,
\fBuserdel\fR
will remove the user\*(Aqs group if it contains no more members, and
\fBuseradd\fR
will create by default a group with the name of the user\&.
.RE
.SH "FILER"
.PP
/etc/group
.RS 4
Gruppkontoinformation\&.
.RE
.PP
/etc/login\&.defs
.RS 4
Shadow password suite configuration\&.
.RE
.PP
/etc/passwd
.RS 4
Anv\(:andarkontoinformation\&.
.RE
.PP
/etc/shadow
.RS 4
S\(:aker anv\(:andarkontoinformation\&.
.RE
.PP
/etc/subgid
.RS 4
Per user subordinate group IDs\&.
.RE
.PP
/etc/subuid
.RS 4
Per user subordinate user IDs\&.
.RE
.SH "AVSLUTNINGSV\(:ARDEN"
.PP
The
\fBuserdel\fR
command exits with the following values:
.PP
\fI0\fR
.RS 4
success
.RE
.PP
\fI1\fR
.RS 4
can\*(Aqt update password file
.RE
.PP
\fI2\fR
.RS 4
invalid command syntax
.RE
.PP
\fI6\fR
.RS 4
specified user doesn\*(Aqt exist
.RE
.PP
\fI8\fR
.RS 4
user currently logged in
.RE
.PP
\fI10\fR
.RS 4
can\*(Aqt update group file
.RE
.PP
\fI12\fR
.RS 4
can\*(Aqt remove home directory
.RE
.SH "T\(:ANK P\(oA"
.PP
\fBuserdel\fR
will not allow you to remove an account if there are running processes which belong to this account\&. In that case, you may have to kill those processes or lock the user\*(Aqs password or account and remove the account later\&. The
\fB\-f\fR
option can force the deletion of this account\&.
.PP
You should manually check all file systems to ensure that no files remain owned by this user\&.
.PP
Du f\(oar inte ta bort n\(oagra NIS\-attribut p\(oa en NIS\-klient\&. Detta m\(oaste genomf\(:oras p\(oa NIS\-servern\&.
.PP
If
\fBUSERGROUPS_ENAB\fR
is defined to
\fIyes\fR
in
/etc/login\&.defs,
\fBuserdel\fR
will delete the group with the same name as the user\&. To avoid inconsistencies in the passwd and group databases,
\fBuserdel\fR
will check that this group is not used as a primary group for another user, and will just warn without deleting the group otherwise\&. The
\fB\-f\fR
option can force the deletion of this group\&.
.SH "SE OCKS\(oA"
.PP
\fBchfn\fR(1),
\fBchsh\fR(1),
\fBpasswd\fR(1),
\fBlogin.defs\fR(5),
\fBgpasswd\fR(8),
\fBgroupadd\fR(8),
\fBgroupdel\fR(8),
\fBgroupmod\fR(8),
\fBsubgid\fR(5), \fBsubuid\fR(5),
\fBuseradd\fR(8),
\fBusermod\fR(8)\&.
|