Users/groups management

Some commands

adduser USER                # Add USER and its home, shell... (Debian command)
groupadd GROUP              # Add GROUP
groupdel GROUP              # Delete GROUP
usermod -a -G GROUP USER    # Add USER to GROUP
gpasswd -d USER GROUP       # Remove USER from GROUP

Remove a user

To remove a user accound with all its files (of which he is the owner), while making a backup at the same time:

deluser --remove-all-files --backup --backup-to /home/ USER

Rename a user

First, rename the user's group:

groupmod --new-name NEW_NAME OLD_NAME

Then rename the user's login, its name and its home directory:

usermod -d /home/NEW_LOGIN -m -l NEW_LOGIN -c NEW_NAME OLD_LOGIN