The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php / cgi access

Discussion in 'General Discussion' started by anand, Mar 30, 2004.

  1. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    I searched it on the forums however found no answer for the same.

    I have a customer, he asked me to disable php/ cgi on a particular folder under his user account. Any ideas how to do so ?

    For perl i can remove the cgi-bin from httpd.conf, but i believe perl scripts can still run outside. Anyway to stop that ?

    For php, while posting this message i found this on a website

    <Directory /home/*/public_html>
    php_admin_flag engine off
    </Directory>

    I will check this.
     
  2. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    I don't think you can do anything clean with cgi, but how about setting up a cron job to chmod 644 /* every 5 minutes or so? That would effectively disable it...
     
  3. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    heheh thats nice. :p

    I just thought is there a way to restrict file accessing through .htacces file ?

    1. Remove the cgi-bin for the user
    2. Setup a .htaccess file to disable access to any .cgi / .pl file.

    Any ideas ? I will check this out in a while though.
     
  4. anand

    anand Well-Known Member

    Joined:
    Nov 11, 2002
    Messages:
    1,435
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    DataCenter Provider
    This seems to be working for me.

    1. cd /home/user/public_html
    2. pico .htaccess

    AddType text/txt .php
    AddType text/txt .cgi
    AddType text/txt .pl

    3. Save and exit.

    Now place any php/cgi/pl inside the directory, it give you to download the file.

    Atleast at present its disabled :)
     
  5. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    Very cool. :)
     
Loading...

Share This Page