Created
August 30, 2013 10:05
-
-
Save danmilleruk/6388324 to your computer and use it in GitHub Desktop.
Finds cPanel users that no longer exist on a particular system, but where the home directory is still intact.
This file contains 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 | |
# Find removed accounts | |
# Dan Miller <dm@sub6.com> | |
cd /home | |
LS=`ls -1 | grep -v 'aquota.user\|cagefs\|quota.user\|lost+found\|cpbandwidth\|cprestore\|cpeasyapache'` | |
echo "" | |
echo "Searching for users with no accounts on `/bin/hostname`" | |
echo "" | |
for i in $LS | |
do | |
if [ ! -e "/var/cpanel/users/$i" ]; then | |
SIZE=`du -sh /home/$i | awk '{print $1}'` | |
echo "- [$SIZE] No userfile match for $i" | |
echo "" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment