Lion
05-23-2001, 10:58 AM
How I can protect all folders index when create new account for my new customer by WHM?
![]() | View Full Version : folders index protecting by WHM Lion 05-23-2001, 10:58 AM How I can protect all folders index when create new account for my new customer by WHM? c0bra 05-23-2001, 11:57 AM You want to stop users browsing individual directories where an index file isn't present - correct? To accomplish this you need to manually edit the httpd.conf file: Look for <directory> options and remove "Indexes" to prevent directory browsing. Restart apache and voila! Lion 05-23-2001, 12:08 PM c0bra, How I can edit the httpd.conf file please? :D Thank you. teck 05-23-2001, 12:16 PM use pico: pico httpd.conf <assuming you are in the right directory where the conf file is> Lion 05-23-2001, 12:54 PM How I can connect to the httpd.conf file, by telnet, FTP ...etc, and how edit it? Thank you?:D :D c0bra 05-23-2001, 01:27 PM Telnet into your server (you should be using SSH, but thats another story:)). Type: locate httpd.conf Then pico /your/path/to/httpd.conf Your path to httpd.conf probably is: /usr/local/apache/conf/httpd.conf Scroll down the file until you find the <directory> subjective. Delete "Indexes" from it. Press Control & O to save the file. Don't change the name of the file, just press enter. Type Y (as in yes). You do want to overwrite the file. Press "Control & X" to exit pico. Now restart apache by typing: /etc/rc.d/init.d/httpd restart Hope that helps. magnafix 05-23-2001, 04:09 PM If you don't have control of the server httpd.conf you can put: Options -Indexes in an .htaccess file in the directory desired. Lion 05-24-2001, 05:32 PM I don't find the <directory> in httpd.conf. Are you sure c0bra? :( Mark Vockler 05-24-2001, 10:47 PM Originally posted by Lion I don't find the <directory> in httpd.conf. Try doing a search for it from within pico. When you're in pico with the file open, hold down the <control> key and type "w". Release the <control> key, then type "<directory>" without the quotes and press <enter>. This should take you to the location of the directive. Once you're there you can make the required modifications before saving the file and restarting apache. Mark Vockler Aletia Hosting Lion 05-25-2001, 04:50 AM I found this: <Directory "/usr/local/apache/htdocs"> # # 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. Is this code? and delete "Indexes" from this code? or there is another code? Thank you. magnafix 05-25-2001, 10:45 AM No that's not code. If a line starts with a #, it's a comment. You want a line that starts with: Options You could always grep Options httpd.conf to find the line in question. And could always turn off Indexes in an .htaccess file instead, as I posted earlier. nox 05-25-2001, 11:08 AM Lion, ...why don't you just upload a placeholder page to your skeleton directory and everytime you set up an account it will be there 'automagically'.... They will doubtless replace it when they upload their site...:) Lion 05-25-2001, 01:00 PM felix220, I don't know placeholder page, Can you help me step by step please? :D nox 05-25-2001, 01:08 PM /root/cpanel3-skel This directory is what will be used as a skeleton for new accounts. For example if you place an index.html file in /root/cpanel3-skel/public_html, and then setup a new account, that account with have a copy of your index.html in their public_html directory. You can just FTP it, no need SSH/telnet.. C'est simple... :) Lion 05-25-2001, 02:45 PM Ok, I will create new page to upload it to /root/cpanel3-skel but I would like know if there is code to write in this page to protect folders and what is this page name? nox 05-25-2001, 02:59 PM The page that you put in the skeleton directory will be automatically added to your customers site as if it's the customers home page (temporary) You won't see the index of files/folders any more. When your client uploads their site, they will replace this page with their own index (home) page so I don't think you need any code for this... unless I'm missing what you're trying to achieve here.. Lion 05-25-2001, 03:15 PM sorry I know that, I don't need index page. the index page will be start page only. I need code or page to protect folders when any one request any folder will receive error page 403. Annette 05-25-2001, 03:28 PM As indicated, you will need to remove the Indexes portion of the Options directive. Note that the below steps edit the server httpd.conf file, so be careful. If you get in a jam following these instructions and want to bail out, type: :q! (hit enter) and any changes you have made will not be written to the file. SSH to the server cd /etc/httpd/conf (hit enter) vi httpd.conf (hit enter) type: /Options (hit enter) Look for a line that says Options Indexes (it will likely have more than just that on the line, but that's what you're looking for. If you don't see it right off the bat, type: / (hit enter) and the system will search for the next occurrence of Options. Position your cursor under the I in Indexes Press the x key to delete the character above the cursor until the word Indexes is gone type: :wq (hit enter) type: /etc/rc.d/init.d/httpd restart (hit enter) OR restart the httpd process from WHM Done. Lion 05-25-2001, 04:35 PM There are two lines that says Options Indexes: 1- Options Indexes FollowSymLinks MultiViews 2- Options Indexes MultiViews Which one delete ? Lion 05-29-2001, 05:07 PM Annette, Where are you? or any one help me please. magnafix 05-29-2001, 05:30 PM You don't want to delete either entire line -- just the word Indexes. You can do it on both lines. Annette 05-29-2001, 07:16 PM Sorry, I don't keep track of a lot of things here... But the previous post is correct: do not delete the entire line out of either file. Just delete the word Indexes from that line, in both files, and you'll be done. hostShopping2 05-30-2001, 03:13 AM Is this done as root? Mark Vockler 05-30-2001, 04:02 AM Originally posted by hostShopping2 Is this done as root? Yes, you need to be root in order to modify the httpd.conf file. Mark Vockler Aletia Hosting hostShopping2 05-30-2001, 04:29 AM Thanks ok . Mine says <Directory /> Options -Indexes FollowSymLinks AllowOverride None </Directory> So I need to change it to: <Directory /> Options - FollowSymLinks AllowOverride None </Directory> with the dash in there or remove the dash? later it says <Directory "/path/to/htdocs"> Options Indexes FollowSymLinks MultiViews so that becomes <Directory "/path/to/htdocs"> Options FollowSymLinks MultiViews ?? magnafix 05-30-2001, 10:51 AM "-Indexes" is identical to no appearance of "Indexes" at all. It means "minus Indexes". If you don't want a directory listing to show up anywhere, then get rid of "Indexes" OR prepend that "-" to it everywhere it appears. Having the "-" by itself will not work however. And you can always test your configuration without breaking anything with: /path/to/apache/bin/apachectl configtest Mark Vockler 05-30-2001, 10:52 PM Originally posted by hostShopping2 <Directory /> Options -Indexes FollowSymLinks AllowOverride None </Directory> Change it to: <Directory /> Options FollowSymLinks AllowOverride None </Directory> Originally posted by hostShopping2 <Directory "/path/to/htdocs"> Options Indexes FollowSymLinks MultiViews This one looks like it's supposed to be commented out (it says "/path/to/htdocs"). But to be safe, you can always change it to: <Directory "/path/to/htdocs"> Options FollowSymLinks MultiViews Hope this helps. Mark Vockler Aletia Hosting hostShopping2 05-30-2001, 10:58 PM Thanks, the "path/to" part I wrote. Even though it probably doesn't matter, I rewrote that for security purposes. You never hurt anything to be too careful :( Lion 05-31-2001, 04:42 AM I changed every things but no work. Any one know another means. Thank you. Mark Vockler 05-31-2001, 04:57 AM Originally posted by Lion I changed every things but no work. Any one know another means. Thank you. Have you restarted apache? killall -9 httpd /etc/rc.d/init.d/httpd start Mark Vockler Aletia Hosting Lion 05-31-2001, 05:18 AM Originally posted by Mark Vockler Have you restarted apache? killall -9 httpd /etc/rc.d/init.d/httpd start Mark Vockler Aletia Hosting Yes, But I don't wrote first line killall -9 httpd only /etc/rc.d/init.d/httpd start |