chage -l <username>
Yes, usually when you login, you will be prompted to change your password or at least notified that it has expired.
chage -l ec2-user Last password change : Jan 16, 2018 Password expires : never Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7
In the case above my password never expires but what if your password expired and you had not logged out – for an account that allows long running connections?
In this case, you’ll get strange errors like:
You are not allowed to access to (crontab) because of pam configuration – if you try to do a crontab -l.
Solution: change your password if it is expired. “chage -l <username> can help show you what is going on.