Join us at IRC!
Capitalism is an Island of wealth in a sea of poverty
Thursday, May 24, 2012
Navigation
Members Online
Total Online: 33
Web Spiders: 15
Guests Online: 30
Members Online: 3

Registered Members: 70189
Newest Member: CrownClown
Latest Articles
View Thread

HellBound Hackers | Computer General | Increasing Security

Author

htaccess problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
Posted on 02-05-09 17:37
Im trying to set up some pretty simple .htaccess configurations on my server, but am having some pretty confusing problems. Here is the file I have so far...

<Files .htaccess>
order allow,deny
deny from all
</Files>

<Files ~ "\.txt$">
Order allow,deny
Deny from all
</Files>

IndexIgnore *


All I am trying to do is disable all dir listing, stop access from the url bar to files with a .txt extension, and of course prevent the htaccess file itself from being accessed.

I have put this file in the root of my server, so it should affect all files and folders on it (so I gather), but I have observed some pretty odd behavior.

If I access a folder on my server, I get a directory listing (www.server.com/folder)
If I access a .txt file in that folder, it gets denied (www.server.com/folder/test.txt)
If I access another subfolder, I get a listing (www.server.com/folder/folder)
If I access a file in that subfolder, I can view the contents (www.server.com/folder/folder/test.txt)

Can anyone see why this isnt working? I shouldnt be seeing these directory listings at all, and the .txt access is really confusing me...

Any help is much appreciated.

Cheers,
JJ


http://soundcloud.com/altimeter
Author

RE: htaccess problems

clone4
Member



Posts: 586
Location: He is back and he's bad!
Joined: 25.11.07
Rank:
God
Posted on 02-05-09 18:04
check your httpd.conf file, search for htaccess string and you should find AllowOverride None directive. Change it to All, and restart the server ;)
Oh and maybe instead of IndexIgnore *, you could use Options -Indexes, which will return 403 forbidden rather then empty index...

Also httpd.config denies by default access to htaccess files, so no necessity to include that...


[img][/img]


spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl



Edited by clone4 on 02-05-09 18:07
clone_4@hotmail.com
Author

RE: htaccess problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
Posted on 02-05-09 19:17
Nice one :D

For some reason my httpd.conf seems pretty empty, theres only 5 lines, no comments or anything I expected to see.. Installed from an apt repo as well.

*edit* Still no joy, I have placed the following lines in my httpd.conf:


<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>


But still no luck...




Edited by jjbutler88 on 02-05-09 19:28
http://soundcloud.com/altimeter
Author

RE: htaccess problems

clone4
Member



Posts: 586
Location: He is back and he's bad!
Joined: 25.11.07
Rank:
God
Posted on 02-05-09 19:29
jjbutler88 wrote:

For some reason my httpd.conf seems pretty empty, theres only 5 lines, no comments or anything I expected to see.. Installed from an apt repo as well.


That certainly isn't right... Check this http://www.devside.net/guides/config/linux/httpd-conf. I'd send you mine, but currently I'm working under windows


[img][/img]


spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl

clone_4@hotmail.com
Author

RE: htaccess problems

clone4
Member



Posts: 586
Location: He is back and he's bad!
Joined: 25.11.07
Rank:
God
Posted on 02-05-09 19:41
MoshBat wrote:
Repos are tailored for the OS, not your use...


but still 5 lines for a server config file seems a little weird to me...

@jjbutler: Have you restarted the server? (I know trivial, but I often forget to do that)

Also:

<Directory "here should be full path to your www folder">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

</Directory>




[img][/img]


spyware - "They see me trollin'..."
<yaragn> ever seen that movie? The Matrix?
<yaragn> with those green lines of flying text?
<yaragn> *THAT'S* Perl



Edited by clone4 on 02-05-09 19:43
clone_4@hotmail.com
Author

RE: htaccess problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
Posted on 02-05-09 20:05
Yeah, I have absolutely no idea how my apache was running with a 5 line config file, got the full version modified now, fixing it up for the errors then gonna give it a spin.




Edited by jjbutler88 on 02-05-09 20:05
http://soundcloud.com/altimeter
Author

RE: htaccess problems

jjbutler88
Colemak User



Posts: 590
Location:
Joined: 22.04.07
Rank:
Guru
Posted on 02-05-09 20:28
Solved! Props to moshbat and clone4 for the help.

The real problem resided in the file '/etc/apache2/sites-available/default'. After changing the AllowOverride to All in there, everything was ok.

Cheers guys :D




http://soundcloud.com/altimeter
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.