Hello there;
I maintain server with 89 account of websites created by my company. I always login to sFTP using root.
When I upload files using root account, they aren't writable with account owner so I wrote this .sh script to help me fix permissions for files for each account:
My problem started when I used second harddisk and mounted it as /home2/ so the .sh script isn't working for all accounts since some accounts are created in home2 instead of home.
I hope someone can guide me to get a variable for correct user public_html directory instead of hard coding it which in some cases isn't correct.
Best Regards
I maintain server with 89 account of websites created by my company. I always login to sFTP using root.
When I upload files using root account, they aren't writable with account owner so I wrote this .sh script to help me fix permissions for files for each account:
Code:
# Get current users lists.
cd /var/cpanel/users
# Loop users.
for user in *
do
# Exclude system, root, nobody users.
if [ "$user" != "system" ] && [ "$user" != "root" ] && [ "$user" != "nobody" ]
then
echo "chown -R $user:$user /home/$user/public_html"
# Update permission to all files in public_html for that user.
chown -R $user:$user /home/$user/public_html
fi
done
I hope someone can guide me to get a variable for correct user public_html directory instead of hard coding it which in some cases isn't correct.
Best Regards