Skip to content

Instantly share code, notes, and snippets.

@ashrithr ashrithr/
Created Oct 6, 2014

What would you like to do?
Linux users with password and currently logged in
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
echo "[*] Users currently logged in: "
for user in ${users_logged_in}; do
echo $user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.