How do I replace all the index pages?


Jul 18, 2003

One of my servers got defaced today and the bad news is that the backup drive was attached to the server so the hacker also defaced the backup pages.

I’m about to do a OS reload (and then secure it etc.) and move all the data from the old drive. Since I do not have any good backup files I was thinking about restoring the sites anyway with the hackers index pages and then replace all the index pages with a index page notifying the user.

What I want to know is this. What commands do I have to enter to replace all the index.(html htm php) pages in the home directory with my page?

By the way I use CPanel

I greatly appreciate any help that you guys can provide.


Well-Known Member
Aug 22, 2004
I hope you need to replace all the index.html files on every public_html folder with a custon index,html file. For this do the following. Let your custom index.html be in path /home/index.html

for i in ` cat /etc/userdomains | awk {'print $2'}` ; do cp -pf /home/index.html /home/$i/public_html/index.html ; chown $i.$i /home/$i/public_html/index.html ; done


Sep 19, 2003
script is still useful

I used this, it is a brute force replace file for file script, but it also changes the permissions (which are usually taken over or rooted by the kiddie script hacker lowlife $%^&) so that the site user can correct the index page.

caution: If a site does not contain index.html this script will create it.
If you want to know what will change, you should run
then `locate index.html` to get a full directory listing of what files will be changed.

for nonscripters, it works like this...
you create a replacement page and put it in the /home/ dir - I had about 130 sites, so I made somthing less scary as my new index page,like a 404 page. then copy paste the script into the command line and the terror part of the hack is done.

good luck