How do I check that a user password is locked?
You can use the passwd utility to look at the status of the user's password entry
passwd -S user
user LK 2012-11-06 0 99999 7 -1 (Password locked.) (CentOS)
user L 01/22/2013 0 99999 7 -1 (Ubuntu)
The LK as well as the (Password Locked) text indicate a locked password entry on CentOS and L indicates a locked password entry on Ubuntu.
You can also use getent to read the shadow database
getent shadow user
user:!$6$ic7iX.Q2$q9K5gi5pOb...TJlhAIoKVJfAybADtv80:15650:0:99999:7:::
or you can just look at the shadow file yourself
grep user /etc/shadow
user:!$6$ic7iX.Q2$q9K5gi5pOb...TJlhAIoKVJfAybADtv80:15650:0:99999:7:::