I can get the date with chage -l username, but I need to get the exact time. How can I get that?

  • There is no time associated to it. It will activate the 1st time someone tries to use an account on the day it expires. – Rinzwind Jul 15 '19 at 6:42
  • I think the only question is if it's local time or UTC time that counts. The day probably starts at midnight anyway. – ilkkachu Jul 16 '19 at 18:09

I don't think it's possible, the details what you get from chage command that's far you get more details about the password details for a user.

[root@LinuxSYS ~]# chage -l linuxuser
Last password change                                    : Jun 19, 2019
Password expires                                        : Aug 18, 2019
Password inactive                                       : Sep 05, 11761240
Account expires                                         : Jan 20, 11761191
Minimum number of days between password change          : 1
Maximum number of days between password change          : 60
Number of days of warning before password expires       : 5
[root@LinuxSYS ~]#

The time will be 12:00:00 UTC for the date the pasword expire, thus:

$ date -ud $(chage -l linuxuser | grep -P '^Password expires[[:space:]]*: ^K.*$')
Sun 18 Aug 2019 12:00:00 AM UTC

Or any other format that date could generate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.