Windows
Linux
Security & Permissions
Users & Groups
Windows net user username /active:no equivalent in Linux
Locks password-based login for a local account without deleting the account or its files.
Windows
→
net user username /active:no
Linux equivalents
sudo usermod -L USER
sudo usermod -L USER
sudo usermod -L USER
Overview
What this command does
Locks password-based login for a local account without deleting the account or its files.
Migration tip: Locking the password may not block every authentication method, such as existing SSH keys or running sessions. Review the complete access policy when disabling an account.
Practical tasks
Common use cases
Lock a user account
Locks password-based login for a local account without deleting the account or its files.
sudo usermod -L alice
Lock the password
sudo passwd -S alice
Show password status
sudo chage -E 0 alice
Expire the account immediately
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
sudo usermod -L alice
sudo passwd -S alice
sudo chage -E 0 alice
Walkthrough
Examples with explanations
sudo usermod -L alice # lock password authentication
sudo passwd -S alice # check account password status
sudo chage -E 0 alice # expire the account
Reference
Common options and variations
| Command or option | Use |
|---|---|
sudo usermod -L alice | Lock the password |
sudo passwd -S alice | Show password status |
sudo chage -E 0 alice | Expire the account immediately |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | sudo usermod -L USER |
Same command on this distribution. |
| Fedora | same command | sudo usermod -L USER |
Same command on this distribution. |
| Arch | same command | sudo usermod -L USER |
Same command on this distribution. |
Keep learning