From 46a31fa7d3a86ed1f7c5ac33e795c4bbf7b9ced3 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 11 Oct 2019 19:29:11 -0600 Subject: Print accounts that do not have an expiration --- .gitignore | 2 ++ README.md | 15 +++++++++++++++ bin/missing-expiration-date | 12 ++++++++++++ 3 files changed, 29 insertions(+) create mode 100755 bin/missing-expiration-date diff --git a/.gitignore b/.gitignore index 91a0115..7574d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ tmp pkg node_modules .bundle +shadow +passwd diff --git a/README.md b/README.md index 84d10d8..c44bff9 100644 --- a/README.md +++ b/README.md @@ -1161,3 +1161,18 @@ Rootly Powers and Processes ``` e. Find entries that have no expiration date (needs /etc/shadow). + + ```bash + #!/bin/bash + + cd "..$(dirname $PWD)" + + for i in `cat /etc/shadow`; do + login=$(echo $i | cut -d: -f1) + expiration=$(echo $i | cut -d: -f8) + + if [ -z "$expiration" ]; then + echo $login: does not have an expiration date + fi + done + ``` diff --git a/bin/missing-expiration-date b/bin/missing-expiration-date new file mode 100755 index 0000000..8a0c7fe --- /dev/null +++ b/bin/missing-expiration-date @@ -0,0 +1,12 @@ +#!/bin/bash + +cd "..$(dirname $PWD)" + +for i in `cat /etc/shadow`; do + login=$(echo $i | cut -d: -f1) + expiration=$(echo $i | cut -d: -f8) + + if [ -z "$expiration" ]; then + echo $login: does not have an expiration date + fi +done -- cgit v1.2.3