In this short article I will show you how to match the accounts with no password, the locked and the expired accounts.
If you see this in the second field (password field) of /etc/shadow, it means:
- ! – the account has no password
- * – the account is locked, the user cannot log in
- !! – the password has expired
Find the users with no passwd:
# cat shadow | cut -d: -f 1,2 | grep '!'
Find the locked accounts:
# cat shadow | cut -d: -f 1,2 | grep '*'
Find the accouns with an expired password:
# cat shadow | cut -d: -f 1,2 | grep '!!'