Deleting Users

Use the deluser command to delete users from your system. This command removes a user’s entry in the system’s /etc/passwd file. You should also use the command’s --remove-all-files and --remove-home option to remove all the user’s files and directories (such as the user’s mail spool file under /var/spool/mail):

matthew@seymour:~$ sudo deluser --remove-all-files --remove-home andrew

If you do not use the -r option, you have to manually delete the user’s directory under /home, along with the user’s /var/spool/mail queue.

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.