document updated 10 years ago, on Jul 20, 2012

There are various ways to lock a user account in Un*x:

add ! to password field in /etc/shadow

Use passwd -l to lock, and passwd -u to unlock.

clear their password field

passwd -d

expire their account

usermod -e 1

chage -E 1

change their shell to /bin/nologin or /bin/false

usermod -s /bin/nologin


In the file 'sshd_config' (perhaps located at /etc/ssh/sshd_config), there are four options you can use:

view current settings

You can view what the current status of someone's account is via: