Howto: Get timestamp of last password change

How To

Get the timestamp of the last password change from an external Linux server.

Prerequisites

Have a user who is allowed to read LDAP database (i.e. Administrator).

Step 1

Get the Unix timestamp of the last Samba password change:
ldapsearch -x -h backup.multi.ucs -p 7389 -LLL -D uid=Administrator,cn=users,dc=multi,dc=ucs uid=testuser -W sambaPwdLastSet
Obviously, replace the user id (uid=testuser) and the hostname (after -h) with the one from your system and replace the LDAP-base (dc=multi,dc=ucs) with the matching ones.

You will get a Unix timestamp which are seconds since 1970:

root@master:~# ldapsearch -x -h backup.multi.ucs -p 7389 -LLL -D uid=Administrator,cn=users,dc=multi,dc=ucs uid=testuser -W sambaPwdLastSet
Enter LDAP Password: 
dn: uid=testuser,cn=users,dc=multi,dc=ucs
sambaPwdLastSet: 1574692220

Step 2

Convert the result from steps 1 to a readable time by

root@master:~# date -d @1574692220
Mo 25. Nov 15:30:20 CET 2019
Mastodon