HxHippy

userdel

Delete a user account and related files

Overview

Deletes a user account and related files. It modifies the system account files, deleting all entries that refer to the LOGIN.

Syntax

userdel [OPTION]... LOGIN

Common Options

-f, --force

Forces the removal of the user account, even if the user is still logged in. It also forces removal of the home directory and mail spool if -r is used, even if shared or not owned by the user.

-r, --remove

Files in the user's home directory will be removed along with the home directory itself and the user's mail spool.

-Z, --selinux-user

Remove any SELinux user mapping for the user's login.

Examples

$ sudo userdel unwanteduser

Deletes the user account unwanteduser, but their home directory and mail spool remain.

$ sudo userdel -r oldemployee

Deletes the user oldemployee and also removes their home directory and mail spool.

$ sudo userdel -f problematicuser

Forcibly removes problematicuser, even if they are logged in. If used with -r, it will forcibly remove home/mail data.

useraccountdeleteremoveloginuserdel