Posted on 02-12-2019 01:13 PM
Does anyone have a EA (or a script) that is able to display the date of a password change for local accounts? I'm trying to track if any of our users are changing the root password or our local admin account password after the computer is deployed.
I've seen a few for network bound accounts, but i need it run on local accounts. So far, i've pulled this:
#!/bin/sh
echo; echo Password Last Changed:; u=$(dscl . list /Users | egrep -v '^_|daemon|nobody'); for i in $u; do printf \n$i\t; currentUser=$i;t=$(dscl . read /Users/"$currentUser" | grep -A1 passwordLastSetTime | grep real | awk -F'real>|</real' '{print $2}'); date -j -f %s "$t" 2> /dev/null; done
I can get the full date and time, but i cant seem to get it to just show a date (time is a little more info than I need) and just clutters up the info.
Posted on 02-12-2019 01:19 PM
@TJ.Edgerly take a look at this thread..
Posted on 02-12-2019 01:42 PM
@TJ.Edgerly I'm using Jamf's script: https://github.com/jamf/Current-User-Password-Age
And I pair that with a policy that warns users of an upcoming pw expiration.
Posted on 01-06-2022 02:06 PM
@sshort do you still have that EA? Looks like the old GitHub got removed.
Posted on 01-12-2022 09:01 AM
ugh, that sucks that it's removed! I used that EA at a previous job, and I can't find it in my old notes.
Posted on 03-16-2022 10:50 PM
It's all good we've still had no luck finding it elsewhere but if you ever do find it I'm still here haha.
Posted on 05-03-2022 03:48 PM
This may not be exactly what you're looking for, but this script at least worked on my system when I tested it. I'm still waiting for the EA to kick in with some inventory updates, and I'll follow up more from there, but if you need this, I'll share what I've built.
Posted on 05-04-2022 07:46 AM
Sorry, the script works, but not as an EA. Here's the update to have it work properly as an EA.
Posted on 05-04-2022 07:51 AM
Ended up going with this:
#!/bin/bash
curUser=$(ls -l /dev/console | cut -d " " -f 4)
passwordAge=$(expr $(expr $(date +%s) - $(dscl . read /Users/${curUser} | grep -A1 passwordLastSetTime | grep real | awk -F'real>|</real' '{print $2}' | awk -F'.' '{print $1}')) / 86400)
echo "<result>${passwordAge}</result>"
Not perfect, but worked for my needs.