Changing or Deleting User Accounts

Change a user account's access, such as the groups it belongs to, and delete a user account.

To change a user account, use the usermod command. The syntax is

sudo usermod [options] username

For example, to add a user to a group other than the user's default login group:

sudo usermod -aG groupname username

You can use the groups command to display the groups a user belongs to, for example:

sudo groups username

To delete a user's account, use the userdel command:

sudo userdel username

For more information, see the groups(1), userdel(8) and usermod(8) manual pages.