diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-11 19:29:11 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-11 19:29:11 -0600 |
| commit | 46a31fa7d3a86ed1f7c5ac33e795c4bbf7b9ced3 (patch) | |
| tree | 3469cc6f546598d5c75208886574b7981bd2e709 | |
| parent | 6a9c857607513af51a367c7e87836b3c6931c6be (diff) | |
Print accounts that do not have an expiration
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | README.md | 15 | ||||
| -rwxr-xr-x | bin/missing-expiration-date | 12 |
3 files changed, 29 insertions, 0 deletions
@@ -3,3 +3,5 @@ tmp pkg node_modules .bundle +shadow +passwd @@ -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 |
