Users and Groups

Create a new user with Home Directory

useradd -m -d /home/<username> <username>

Add user to sudoers group

usermod -aG sudo <username>

Set Default shell for a user

usermod --shell /bin/bash <username>
# OR #
chsh --shell /bin/sh <username>

Delete a user and purge their /home/

Use the -r (--remove) option to force userdel to remove the user’s home directory and mail spool

userdel -r <username>

Last updated

Was this helpful?