[Samba] Smba 4, looking for a command to show the password expiration date
Steve Thompson
smt at vgersoft.com
Wed May 6 07:23:49 MDT 2015
On Wed, 6 May 2015, Mario Pio Russo wrote:
> I am developing a tool in perl to run on my sabma4-DC. This tool must check
> the password exp date and send a reminder when quite close. Now in order to
> do that, I need a command to extract the expiration date from samba 4.
Extract the value of the password lifetime into the LIFETIME variable:
LIFETIME=`samba-tool domain passwordsettings show | \
grep "^Maximum password age (days):" | awk '{print $5}'`
and then, for the user in question, extract the value of pwdLastSet into
LASTSET (perhaps from ldbsearch), and then:
LASTSET=$((LASTSET/10000000))
LASTSET=$((LASTSET-11644473600))
EXPIRES=$((LASTSET+3600*24*LIFETIME))
EXPIRESSTR=`date -d @$EXPIRES`
echo "Password expires $EXPIRESSTR"
-Steve
More information about the samba
mailing list