Created
October 6, 2014 04:01
-
-
Save ashrithr/efd4f36777a3674e4d88 to your computer and use it in GitHub Desktop.
Linux users with password and currently logged in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
users_with_pwd=$(awk -F":" '!($2 == "" || $2 == "!!" || $2 == "*") {print $1}' /etc/shadow) | |
users_logged_in=$(who | awk '{print $1}' | uniq) | |
echo "[*] Users with password: " | |
for user in ${users_with_pwd}; do | |
echo $user | |
done | |
echo "[*] Users currently logged in: " | |
for user in ${users_logged_in}; do | |
echo $user | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment