Changing file ownership after Joomla upgrade
Simple shell script for Joomla hosting providers to update Joomla sites on their linux server
After you upgreaded all your Joomla sites on your server using my Joomla upgrade script, you may want to change file ownership back to the individual user. The reason is that new files in an upgrade package will belong to root if you executed the Joomla upgrade script.
To automate the task of changing file ownership back to your users - i.e. your clients who have a cPanel hosting account on your server, you can use the script below to do this with a single command.
Copy the text below into a new file with the extension .sh or download changeownership.sh (558b).
To invoke the script type:
sh changeownership.sh
#!/bin/sh
# This is changeownership.sh
# sets ownership for Joomla directories and files after Joomla upgrade
# WARNING! Use this only if you know what a shell is, and commands like pwd, ls,
# -lisa, sed, grep and awk.
# Use at own risk!
# enter the usernames of accounts on your server, space separated
users="user1 user2 user3"
for u in $users; do
echo setting ownership for $u
chown -R $u:$u /home/$u/public_html
chown $u:nobody /home/$u/public_html/
echo $u ownership set
done
echo Ownerships for all Joomla sites in userlist updated
It is very important that your public_html folder belongs to user:nobody. You will get a server error if you change ownership of that directory and the sites will be down!
Enjoy the ease of this script.