I want to make the script to extract the users of linux server and check if "/home/$user/public_html/vb/includes/config.php" is exist , i want the script to check all the users in the server and search many files in all users
1 Answer
This will search for public_html/vb/includes/config.php
in the home directory of every user on the system, no matter how they are defined (/etc/passwd, ldap, yp, etc)
file="public_html/vb/includes/config.php"
for homedir in $(getent passwd | cut -d: -f6) ; do
f="${homedir}/${file}"
[ -e "$f" ] && echo "$f"
done