June 23, 2006

Removing wp-comments-post.php and wp-trackback.php

This assumes you have the wordpress blogs in the root on your domains - this doesn’t cover subdirectories/subdomains. If in doubt, contact your tech support and have them do this.

(1) Login to your server (shell access), change directory to your /home directory (this assumes you have a directory in the format /home/usernam1/public_html/).

(2) Create a file called “delete.com”, edit the file and put this on the first line.

#!/bin/sh

(3) Save and exit the file.

(4) Run the following on the command line:

ls | perl -ne ’s/\///;chomp;split;print “$_ “;’ >> delete.com

(5) Go back in and edit the file and put (a) accounts=” at the beginning of the second line and (b) a closing quote around the end of the last username that was added. You might need to remove some entires that are obviously not the username of accounts on your server. In my case, I need to remove “.”, “..”, “.cpan”, and “MySQL-install”.

(6) Add the following to delete.com:

for account in $accounts
do
\rm /home/$account/public_html/wp-comments-post.php
\rm /home/$account/public_html/wp-trackback.php
done

delete.com should look like this:

#!/bin/sh
accounts=”usernam1 usernam2 usernam3 usernam4″
for account in $accounts
do
\rm /home/$account/public_html/wp-comments-post.php
\rm /home/$account/public_html/wp-trackback.php
done

where usernam1 usernam2 etc are the usernames for each domain.

(7) Save and exit delete.com. Change the permissions to the delete.com file using the following command:

chmod 777 delete.com

(8) At the command line, type “delete.com”.

(9) Delete the file delete.com

If in doubt, contact your tech support.

Also, instead of deleting the two files, consider replacing them with empty files. If a visitor clicks on a link that calls either of those files that don’t exist, your path gets displayed.

#!/bin/sh
accounts=”usernam1 usernam2 usernam3 usernam4″
for account in $accounts
do
\cp wp-comments-post.php /home/$account/public_html/wp-comments-post.php
\cp wp-trackback.php /home/$account/public_html/wp-trackback.php
done

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
    del.icio.us digg Fark YahooMyWeb Reddit blinkbits BlinkList blogmarks co.mments connotea De.lirio.us feedmelinks Furl LinkaGoGo Ma.gnolia NewsVine Netvouz RawSugar scuttle Shadows Simpy Smarking Spurl TailRank Wists
Filed under Web by admin.
Permalink • Print • 

Leave a comment