got the simple code below
USERS=`cat /etc/passwd`
for USER in $USERS
do
echo "---------- $USER --------------"
last -n 4 $USER
done
I want to ideally remove all users who haven't logged in for over 60 days.
But the problem with reading the /etc/passwd
is that i get all of the system users as well.
Any ideas how to get just the user created accounts and remove them is they havent logged in for 90 days.
Cheers
/etc/passwd
.chage
. Withchage -l user
you can info and withchage --something
make users disable after XX days.