-
Notifications
You must be signed in to change notification settings - Fork 0
/
user-list
28 lines (27 loc) · 1.03 KB
/
user-list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
if [ -f /etc/debian_version ]; then
UIDN=1000
elif [ -f /etc/redhat-release ]; then
UIDN=500
else
UIDN=500
fi
echo "----------------------- พัฒนาโดย คุณเต้ ทารุมะ (เต้เล็ก) -----------------------"
echo " "
echo " [+] รายชื่อผู้ใช้ใน VPS:"
echo " [+] (USERNAME) - (EXP DATE) "
echo "-------------------------------"
while read ceklist
do
AKUN="$(echo $ceklist | cut -d: -f1)"
ID="$(echo $ceklist | grep -v nobody | cut -d: -f3)"
exp="$(chage -l $AKUN | grep "Account expires" | awk -F": " '{print $2}')"
if [[ $ID -ge $UIDN ]]; then
printf "%-17s %2s\n" "$AKUN" "$exp"
fi
done < /etc/passwd
JUMLAH="$(awk -F: '$3 >= '$UIDN' && $1 != "nobody" {print $1}' /etc/passwd | wc -l)"
echo "-------------------------------------"
echo " [+] จำนวนบัญชีที่มีใน VPS ของคุณ : $JUMLAH ผู้ใช้งาน"
echo "-------------------------------------"
echo " ";