Locking and Unlocking user account on Linux

If you need to politely refuse a login for a user, you use the command
# usermod -s /sbin/nologin UserLoginName

To unlock the user account
# usermod -s /bin/bash UserLoginName


Alternatively, you can use the commands to lock the user account
# passwd -l UserLoginName

To unlock the user account
# passwd -u UserLoginName