Added on May 18th, 2012 and marked as config server

Add user

Create a new user:

adduser {USER}

(Or you could use useradd.)

Display user and group IDs:

id {USER}

Add group

Create a new group:

addgroup {GROUP}

Add an existing user to an existing group:

usermod -a -G {GROUP} {USER}

Change the primary group of an existing user:

usermod -g {GROUP} {USER}

Delete user

To remove a user:

userdel {USER}

Use userdel -r {USER} to remove the user’s home directory and mail spool. Any other files owned by the user should be removed manually.

userdel will not allow you to remove an account if there are running processes which belong to this account. In that case, you may have to kill those processes or lock the user’s password or account and remove the account later. The -f option can force the deletion of this account.

If the primary group associated with this user does not contain any other users, the group itself will also be removed.

Background information