Note: This is an RHCSA 7 exam objective.

To create a local user account (here user), type:

# useradd user

Note: a group with the same name is automatically created.

To create a local user account (here user) with given UID and GID, type:

# useradd -u UID -g GID user

To create a local user account (here user) with a secondary group (here team), type:

# useradd -G team user

To create a local user account (here user) without login access (useful for Samba configuration), type:

# useradd -s /sbin/nologin user

To delete a local user account (here user) with removal of the user’s home directory and the user’s mail spool (-r), type:

# userdel -r user

Note: the associated group is automatically removed.

To change the name of a user account (here from user to usr), type:

# usermod -l usr user