Skip to content

Instantly share code, notes, and snippets.

@SSARCandy
Last active January 4, 2018 10:37
Show Gist options
  • Save SSARCandy/b22e136d7833e5453d3f8f1dc46ba606 to your computer and use it in GitHub Desktop.
Save SSARCandy/b22e136d7833e5453d3f8f1dc46ba606 to your computer and use it in GitHub Desktop.
list account expire status
#/bin/bash
sudo cat /etc/shadow \
| awk -F : -v d=$(expr `date +%s` / 86400) \
'{
if ($8 >= 0) {
if ($8 > d || $8 <= 0) printf "%15s %5d %s\n", $1, $8, "";
else printf "%15s %5d %s\n", $1, $8, "Expired";
}
}' \
| sort -k 3,3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment