Академический Документы
Профессиональный Документы
Культура Документы
Description
deluser and delgroup remove users and groups from the system according to command line options
and configuration information in /etc/deluser.conf and /etc/adduser.conf. They are friendlier front
ends to the 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. deluser and
delgroup can be run in one of three modes:
To Remove A Group
If 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 --only-if-empty is given, the group won't be removed if it has any members left.
--group Remove a group. This is the default action if the program is invoked as delgroup.
Backup all files contained in the userhome and the mailspool file to a file named /
--backup
$user.tar.bz2 or /$user.tar.gz.
Place the backup files not in / but in the directory specified by this parameter. This
--backup-to
implicitly sets --backup also.
Remove the home directory of the user and its mailspool. If --backup is specified,
--remove-home
the files are deleted after having performed the backup.
Remove all files from the system owned by this user. Note: --remove-home does
--remove-all-files not have an effect any more. If --backup is specified, the files are deleted after
having performed the backup.
Configuration
The file /etc/deluser.conf contains defaults for the programs deluser and delgroup. Each option takes
the form "option = value". Double or single quotes are allowed around the value. Comment lines must
have a hash sign ("#") at the beginning of the line.
deluser and delgroup also read /etc/adduser.conf, see adduser.conf; settings in deluser.conf may
overwrite settings made in adduser.conf.
The valid configuration options are:
REMOVE_HO Removes the home directory and mail spool of the user to be removed. Value may be
ME 0 (don't delete) or 1 (do delete).
REMOVE_AL Removes all files on the system owned by the user to be removed. If this option is
L_FILES activated REMOVE_HOME has no effect. Values may be 0 or 1.
If REMOVE_HOME or REMOVE_ALL_FILES is activated, all files are backed
up before they are removed. The backup file that is created defaults to
BACKUP
username.tar(.gz|.bz2) in the directory specified by the BACKUP_TO option. The
compression method is chosen to the best that is available. Values may be 0 or 1.
ONLY_IF_EM
Only delete a group if there are no user who belong to this group. Defaults to 0.
PTY
A regular expression which describes all file systems which should be excluded
EXCLUDE_FS
when looking for files of a user to be deleted. Defaults to "(proc|sysfs|usbfs|devpts|
TYPES
tmpfs|afs)".
Return Value
0 The action was successfully executed.
1 The user to delete was not a system account. No action was performed.
6 The user does not belong to the specified group. No action was performed.
7 You cannot remove a user from its primary group. No action was performed.
The required perl package 'perl modules' is not installed. This package is required to perform the
8
requested actions. No action was performed.
9 For removing the root account the parameter "--force" is required. No action was performed.
Files
/etc/deluser.conf Configuration file.
Deletes the user account myuser, and removes that user's home directory as well.
deluser --force myuser
Deletes the user account myuser even if that user is currently logged in.
deluser --backup-to /directory myuser
Deletes the user account myuser and backs up their files in a tar archive called myuser.tar, which is
created in the directory /directory.
delgroup mygroup