There are times where you want to remove a user from Linux. This section guides you on how to delete a user properly.
Before starting to remove the group, you must ensure that all the files and directories owned by the group is changed to a new group owner. Otherwise, it can very hectics and requires root account to do a bunch of clean-up works.
First, you need to identify the ownership of the remaining files by the user. Once done, you need to change the owner accordingly using chown command:
$ chown {-R} [user] [file|directory]
Example:
$ chown -R admin /media/localstore/datacare
Once you're done with it, you can proceed to remove user. To do that, simply issue the following command with optional remove home or remove all files argument:
$ deluser [--remove-home|--remove-all-files] <username>
Example, to remove all files related to james, it is:
$ deluser --remove-all-files james
That's all for removing user from a Linux Operating System.