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.

Disbable Global Server Directory Listing?

Discussion in 'General Discussion' started by shaky, May 25, 2004.

  1. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Is it possible to disbable the global server directory listing by default?

    Whenever I design a site for a client I have to manually upload an .htaccess file to that particular account so that it disables directory listing on the site.

    But does anyone know how I can disable directory listing for my entire server?

    Is the answer in here somwhere?

    SSH:

    /usr/local/apache/conf/httpd.conf


    Thanks....
     
  2. myrem

    myrem Well-Known Member

    Joined:
    Jul 14, 2002
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Edit:
    ack.
    Scratch that... that's not going to work.

    Anyone else?
     
    #2 myrem, May 25, 2004
    Last edited: May 25, 2004
  3. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Oops myrem, I just tried your post before you edited it... :)

    Will revert, but thx.
     
  4. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Is this what it my code is supposed to look like myrem? I forgot...

    #
    # This may also be "None", "All", or any combination of "Indexes",
    # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    Options Indexes FollowSymLinks MultiViews
     
  5. myrem

    myrem Well-Known Member

    Joined:
    Jul 14, 2002
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    yeah, that's right.

    I think the correct place to do it is:
    Code:
    # Each directory to which Apache has access, can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories).
    #
    # First, we configure the "default" to be a very restrictive set of
    # permissions.
    # 
    <Directory />
    Options All 
    AllowOverride All
    </Directory>
    On the above options lines. But tried adding "-Indexes" to it but that didn't help either. :(
     
  6. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Shame I was going to try that also :(

    But thanks for trying.
     
  7. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Anyone any ideas...?
     
  8. alex042

    alex042 Well-Known Member

    Joined:
    Sep 13, 2003
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    Under Options, have you tried just removing 'indexes'?
     
  9. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Yep, and also restarted apache but made no difference....;)
     
  10. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Actually, you needed to go a bit lower down.

    # This controls which options the .htaccess files in directories can
    # override. Can also be "All", or any combination of "Options", "FileInfo",
    # "AuthConfig", and "Limit"
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
    </Directory>

    <Directory /home/*/public_html>
    Options -Indexes
    </Directory>
     
  11. shaky

    shaky Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Thanks Website Rob it works! :D
     
  12. Tina

    Tina Well-Known Member

    Joined:
    Jan 27, 2003
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    6
    That entire <Directory /home...> section is commented out in my httpd.conf

    So right underneath it I inserted this (just like above)

    <Directory /home/*/public_html>
    Options -Indexes
    </Directory>

    restarted apache and it worked perfect!

    Thanks!!!

    Tina
     
  13. certify

    certify Active Member

    Joined:
    Jan 3, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    disable directory listing

    When I put try to disable directory listing using htaccess I get "Internal Server Error"

    <Directory /home/*/public_html>
    Options -Indexes
    </Directory>

    when I type the domain.com it will not forward to index.asp?
     
  14. 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
    Re: disable directory listing

    Try this

    <Directory /home/username/public_html>
    Options -Indexes
    </Directory>

    Substitute the username with your username.

    Btw to make the domain auto forward to index.asp (hmm is it asp or its a typo ?) just edit /usr/local/apache/conf/httpd.conf and locate this:

    # DirectoryIndex: Name of the file or files to use as a pre-written HTML
    # directory index. Separate multiple entries with spaces.
    #

    Below this you can put index.asp (if its not present).
     
  15. certify

    certify Active Member

    Joined:
    Jan 3, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Yes it's .asp

    Thanks for the tip. :)

    I put a .php to do auto forwarding instead for the mean time. :p
     
  16. jrblaine

    jrblaine Member

    Joined:
    Aug 10, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Indexing / Fancy Indexing

    Is there a way to globaly turn off indexing without having to add a .htaccess file in every folder? putting -indexing in just the root of a domain doesn't affect the sub domains, and putting -indexing in access.conf doesn't seem to do anything either. Maybe its the version of apache i have running. Anyone know? Thanks.
     
  17. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    To turn off Directory listing server wide, edit httpd.conf file and replace the below line

    from
    Options Indexes FollowSymLinks
    to
    Options FollowSymLinks

    and also define that indexes are not allowed as below:
    <Directory>
    Options -indexes
    </Directory>

    If the above changes doesn't work, search for

    Options All
    and change it to
    Options -indexes All

    Don't forget to restart apache in either case.
     
  18. Hardy

    Hardy Member

    Joined:
    Dec 7, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Directory Browsing/Listing

    Hello all, I need some help here

    Since I upgraded to the latest version of apache2, I can not turn OFF Directory browsing/listing.

    I've always had it server-wide and I do have many domains on the server so doing it through .htaccess will not be the option for me. Though it does work using option.

    I tried to edit the /usr/local/apache/conf/access.conf
    I tried these companations:

    Options FollowSymLinks ExecCGI Includes
    Options +FollowSymLinks +ExecCGI +Includes -Indexes
    Options FollowSymLinks ExecCGI Includes -Indexes

    and of course I restart the apache server every time but nothing is working.
    I've tested the above on more than one domain,
    Also made sure that these domains' .htaccess is not overriding these settings


    Nothing works!

    Please lend a hand, Thank you in advance.
     
  19. Hardy

    Hardy Member

    Joined:
    Dec 7, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Resolved!

    Well, since no one helped, I hope this helps the next person.
    Though you have to first look at /usr/local/apache/conf/access.conf
    and make sure that [Indexes] is not part of Options or with a minus sign in front of it.

    I found this entry in the http.conf file which seems to be the problem.

    <Directory "/">
    Options All
    AllowOverride All
    </Directory>

    You have to remove [All] and add whatever you want to be enabled.

    This fixed the problem, and I believe it was inserted in the file as a default setting. So watch out if you don't want anyone to look at your files in directories without an index file.
     
  20. Zonaxx

    Zonaxx Member

    Joined:
    Sep 6, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I have tried the same thing:

    On /usr/local/apache/conf/httpd.conf

    Code:
    <Directory "/">
        Options -indexes All
        AllowOverride All
    </Directory>
    
    <Directory "/usr/local/apache/htdocs">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    
    </Directory>
    
    <IfModule dir_module>
        DirectoryIndex index.html index.htm index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.
    php3 index.php index.phtml default.htm default.html home.htm
    
    </IfModule>
    
    Restarted apache, but indexing still occurs by default.

    Any other ideas?

    Thanks,
    Bret
     
Loading...

Share This Page