How To Lock/Unlock User Accounts From The Terminal Under Ubuntu/Linux Mint
sudo usermod –expiredate 1 username
Replace username with the user account name you want to disable. The user account in question will no longer be able to login using its password either locally or remotely. To unlock it, use this command:
sudo usermod –expiredate -1 username
The user account name will now be able to log in to its session.
Alternatively, you can use this command to lock a user account:
sudo passwd -l username
Replace username with the user account name you want to lock. If the command is successful, you will get this output:
passwd: password expiry information changed.
However, the user may have access to its account remotely (via SSH). So, the first method is highly recommended. To unlock the same account, you can execute this command:
sudo passwd -u username
Note: You can use this tip for Ubuntu 12.10/12.04 and Linux Mint 14 or older.