User account management cheat sheet
sudo useradd joshua # create user
sudo useradd -m -d /home/customhome joshua # create user with custom home directory
sudo useradd -s /bin/bash joshua # create user with shell
# Password:
sudo passwd joshua # Set password for joshua
sudo passwd -l joshua # Locks account
sudo passwd -u joshua # Unlocks account
#User Modify
sudo usermod -aG developers joshua # adds joshua to developers group
sudo usermod -d /home/newhomedir joshua # Gives joshua new home directory
sudo usermod -aG sudo joshua # adds joshua to sudo group
# Change Shell
sudo usermod -s /bin/bash joshua
# Delete user account
sudo userdel -r joshua # -r deletes their home directory as well.
# Switch users
su - joshua
# List users groups
groups
Top comments (0)