Create, control and secure accounts from the shell with practical commands. 15.11.2025 | reading time: 2 min Every Linux system depends on users and passwords to control access; this guide shows how to add an account, assign a password, and verify identity using standard command-line tools so you can act confidently at the shell. Onboard a new user Do this now: create a user, set his password, and check the account; example commands: ```sudo useradd -m -s /bin/bash alice``` then set the password non-interactively: ```echo 'alice:Secr3t!' | sudo chpasswd``` verify the account: ```id alice``` which might show ```uid=1001(alice) gid=1001(alice) groups=1001(alice)``` and confirm login context: ```su - alice -c 'whoami'``` which should output ```alice```. Locking, expiry and where passwords live Passwords are stored as hashes in a restricted file; look in ```/etc/shadow``` (not readable by normal users) and inspect account aging with ```sudo chage -l alice``` to see expiry; lock a password with ```sudo passwd -l alice``` and unlock with ```sudo passwd -u alice``` which is useful for temporary suspension; use ```sudo usermod -L alice``` to lock the account itself and ```sudo usermod -U alice``` to unlock. Other useful operations Modify an account without deleting it: change username or home with ```sudo usermod -l newname -d /home/newname -m alice``` and remove an account and its files with ```sudo userdel -r alice```; to add a user to sudoers give him group membership: ```sudo usermod -aG sudo alice``` on Debian-like systems, and always verify with ```getent passwd alice``` or ```getent group sudo``` to confirm membership. Next steps You now know the commands to create accounts, assign and lock passwords, and check identity; keep practicing on a virtual machine and explore password policies and PAM modules next, and consider formal certification to prove skills — pursue CompTIA Linux+ or LPIC-1 with intensive exam prep at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. setup security utilities scripting