Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How do I replace all the index pages?

Discussion in 'General Discussion' started by saver0, Nov 9, 2006.

  1. saver0

    saver0 Member

    Jul 18, 2003
    Likes Received:
    Trophy Points:

    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.
  2. david510

    david510 Well-Known Member

    Aug 22, 2004
    Likes Received:
    Trophy Points:
    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
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sandboks

    sandboks Registered

    Sep 19, 2003
    Likes Received:
    Trophy Points:
    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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice