How do you lock or expire a user account?
IntermediateConceptPermissions, Users & sudo
Answer
sudo usermod -L alice # lock password (prefixes hash with !)
sudo usermod -e 1 alice # expire account (blocks all logins incl. SSH keys)
sudo chage -l alice # view ageing info
sudo usermod -s /usr/sbin/nologin alice
-L alone does not stop SSH key logins; expiring the account or changing the shell does.
More on Permissions, Users & sudo
Explain the rwx permission model for files and directories.BeginnerHow does octal notation work in chmod?BeginnerWhat does chown do and who can run it?IntermediateWhat is umask and how is the final permission calculated?IntermediateWhat is SUID and give a real example?IntermediateWhat does SGID do on files versus directories?Intermediate