Skip to content

Instantly share code, notes, and snippets.

@riordanz
Created May 6, 2017 11:34
Show Gist options
  • Save riordanz/da1083c15604b826bee5ff836c5c6452 to your computer and use it in GitHub Desktop.
Save riordanz/da1083c15604b826bee5ff836c5c6452 to your computer and use it in GitHub Desktop.
list user
#!/bin/bash
clear
echo "Created By : FreeDroid"
echo "=========================================";
echo "USERNAME EXP DATE "
echo "=========================================";
while read mumetndase
do
AKUN="$(echo $mumetndase | cut -d: -f1)"
ID="$(echo $mumetndase | grep -v nobody | cut -d: -f3)"
exp="$(chage -l $AKUN | grep "Account expires" | awk -F": " '{print $2}')"
if [[ $ID -ge 1000 ]]; then
printf "%-17s %2s\n" "$AKUN" "$exp"
fi
done < /etc/passwd
JUMLAH="$(awk -F: '$3 >= 1000 && $1 != "nobody" {print $1}' /etc/passwd | wc -l)"
echo "-------------------------------"
echo "Jumlah akun: $JUMLAH user"
echo "-------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment