Any user account can be locked or unlocked only by Administrator (i.e root user). This is done using passwd command as explained below. When an user account is locked, Linux sets a irrecoverable password for that account so that login always fails. However Linux still stores the original password of the account before locking so that unlocking such account retains its original password.

To lock a user account (liz) from logging in:

[root@techpulp ~]# passwd -l liz
Locking password for user liz.
passwd: Success
[root@techpulp ~]#

To unlock a user account (liz):

[root@techpulp ~]# passwd -u liz
Unlocking password for user liz.
passwd: Success
[root@techpulp ~]#

You can read this article for confirming password status of an user account.