Find all WordPress folders with 777 permissions

How to find all folders with 777 permissions


As the owner of a dedicated server provided shared hosting services, you will find that many of your clients will install applications such as WordPress. So far so good. However, once they start getting stuck with file and folder permissions, they generally go crazy and set everything to 777 in order to fix the problems. Great, they get their site working! Now begin your problems.

With these liberal file and folder permissions together with some not-so-well written plugins, it is only a matter of time before the hackers and crackers target these weak WordPress sites and start injecting all manner of redirects and mail spammers on your server.

Using ‘find’ to locate those weaknesses

So, here is a nifty solution to find all those weak WordPress installations. The following find will list all WordPress installations that contain folders with 777 permissions:

find /var/www/vhosts/*/httpdocs/wp-content -perm 0777 -type d | grep -v "wp-content/"

Give this a whirl on your Plesk server and take a look at the list, navigate to each folder and tighten up the permissions as below:

cd /var/www/vhosts/dodgydomain.co.uk/httpdocs
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 750 ../httpdocs

These permission changes eliminate all unnecessary 777 permissions.

Ok, let’s automate the whole process

What? You have lots of these? Then here is a nifty script to automate the process for you:

df=`find /var/www/vhosts/*/httpdocs/wp-content -perm 0777 -type d | grep -v "wp-content/" \
| sed "s/wp-content//g"`

for line in $df;
  do
    echo $line
    cd $line
    find $line -type d -exec chmod 755 {} \;
    find $line -type f -exec chmod 644 {} \;
    chmod 750 $line
  done

This makes things a little more difficult for any would-be injection attempts. If your directory structure is different to the standard Plesk structure simply modify the find command as required.

Server Relocation (Scheduled) 11-12 November

MICROLITE14 Server Relocation (Scheduled)

Affecting Server – M14 | Priority – Critical

UK Cheapest has experienced tremendous growth over the last decade and we couldn’t have done this without you. With the growth which we have experienced year over year, it has come to the stage where we have utilised most of our existing data centre space resulting in us needing to prepare ourselves for the future.

Throughout the November 2013, we will be migrating our data centre hardware to a larger data centre in Reading and your server(s) hardware will need to be moved to our new data centre space.The migration of your server is scheduled to commence on 11-11-2013 and will be completed between 10 PM UK time on 11-11-2013 and 6 AM UK time on 12-11-2013. We regret to inform you that your service will be unavailable during this migration process.

We will take a complete backup of your server before migrating it to the new data centre. If you have any questions regarding your server migration we encourage you to respond to this ticket where one of our senior technicians will be happy to answer any questions or concerns you may have.

We would like to take this opportunity to apologies in advance for the disruption and inconvenience this migration may cause you and we will do everything we can to minimise it.

Yours sincerely,

Support Team

Date – 11/11/2013 22:00 – 12/11/2013 06:00

Last Updated – 31/10/2013 10:56

 

Server Relocation (Scheduled) 14-15 November

MICROLITE13 Server Relocation (Scheduled)

Affecting Server – M13 | Priority – Critical

UK Cheapest has experienced tremendous growth over the last decade and we couldn’t have done this without you. With the growth which we have experienced year over year, it has come to the stage where we have utilised most of our existing data centre space resulting in us needing to prepare ourselves for the future.

Throughout the November 2013, we will be migrating our data centre hardware to a larger data centre in Reading and your server(s) hardware will need to be moved to our new data centre space.The migration of your server is scheduled to commence on 14-11-2013 and will be completed between 10 PM UK time on 14-11-2013 and 6 AM UK time on 15-11-2013. We regret to inform you that your service will be unavailable during this migration process.

We will take a complete backup of your server before migrating it to the new data centre. If you have any questions regarding your server migration we encourage you to respond to this ticket where one of our senior technicians will be happy to answer any questions or concerns you may have.

We would like to take this opportunity to apologies in advance for the disruption and inconvenience this migration may cause you and we will do everything we can to minimise it.

Yours sincerely,

Support Team

Date – 14/11/2013 22:00 – 15/11/2013 06:00

Last Updated – 31/10/2013 10:56

£1 for .CO.UK domains! Hurry!

Only £1 for .CO.UK domains – Hurry!

Would you believe it? You can register a .CO.UK domain name for 1 year for only £1, hurry though, this is a time limited offer, so grab your new .CO.UK domain name today!

How to claim: Use promo code ONEPOUND at the checkout when registering a .CO.UK domain name for 1 year.

Linux Performance: Remount EXT3 partitions using ‘noatime’

Increase Drive Performance by 40% using noatime

Are you feeling the heat on your dedicated server, getting high I/O wait times?

If you are using EXT3 partitions then it is worth checking to see if they are mounted using ‘noatime’. If they are not, then every read to your partition is also a write which can massively reduce hard drive performance.

First, find all partitions mounted as EXT3 mount without noatime:

# mount | grep ext3
/dev/sda1 on / type ext3 (rw,noatime)
/dev/sdb1 on /backup type ext3 (rw)

Any not showing the noatime attribute, simply remount like so:

# mount -o remount,noatime /backup

You can do this without a server reboot, you can do this with the server live and with the partitions already mounted.