Wordpress Security Functions for Multiple domains

I was using Olly Connelly's VPSBible to get started as a newbie, he gives you this script to tighten up your security, so when you need to install a plugin you run wpupgrade from the console and when you are done you run wpsafe. I am no linux/wp security guy, so I just trust that it is of value so I use it. However, I do not know how to get the function to work for multiple domains.

I ran the script for domain1.com, then domain2.com, then domain3.com thinking it would add each domain to the function, but instead it replaces the previous with the last… can anyone tell me how I can get the function to operate multiple domains at the same time?

### Edit the 2 values first, then post the whole lot. 
#
export DOMAIN="yourblog.com"
export USER="vpsUsername"
#
echo '
#########################
### WordPress 'chown' ###
#########################
## Allow WordPress Upgrades/Plugin Installs
alias wpupgrade="sudo find /home/USERNAME/public_html/DOMAIN/public/wp-admin -exec chown -R www-data:webmasters {} \; && sudo find /home/USERNAME/public_html/DOMAIN/public/wp-content -exec chown -R www-data:webmasters {} \;"
## Revert to Safe WordPress Ownership
alias wpsafe="sudo find /home/USERNAME/public_html/DOMAIN/public/wp-admin -exec chown -R USERNAME:webmasters {} \; && sudo find /home/USERNAME/public_html/DOMAIN/public/wp-content -exec chown -R USERNAME:webmasters {} \;"
' >> /home/$USER/.bashrc
sed -i "s/USERNAME/$USER/g" /home/$USER/.bashrc
sed -i "s/DOMAIN/$DOMAIN/g" /home/$USER/.bashrc
source /home/$USER/.bashrc
source /root/.bashrc

1 Reply

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct