Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old January 29th, 2009, 08:10 AM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
Apache - Directory / File Regexps

Yup, its another reg exp issue :p

I'm trying to restrict access to all folder except one for anyone but me accessing my server. Im trying to put a regexp in the <directory> tag. But I'm not sure how to get the expression for this one.

What I've come up with seems only to hide the folder, rather than show only that one. Is it possible to use an operator like ! or something for does not equal?

Havent been able to find the right order with my messing around.
__________________
~~==~~ Whoever said nothing is impossible never tried pushing a revolving door ~~==~~

Reply With Quote
  #2  
Old January 29th, 2009, 03:06 PM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Take a look here, I think it will help - also with all of the 'expert-exchange' pages you have to scroll all the way down to the bottom of the page (it takes a little while to load the whole thing) to get to the actual resolutions instead of the ones that say 'sign-up' or whatever.
http://www.experts-exchange.com/Sof...Q_23352102.html
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge.

Reply With Quote
  #3  
Old January 29th, 2009, 06:18 PM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
do you mean when you are accessing your server locally? you could just put another .htaccess in that folder with something simple like:

Code:
order deny,allow
deny from all
allow from 127.0.0.1


.htaccess files in subfolders take precedence over the .htaccess in the parent folders. I use this to deny access to my include, class and module folders.

Reply With Quote
  #4  
Old January 30th, 2009, 04:02 AM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
No, from externally.

If you put something like

<Files "Audio">
Order,deny allow
Deny from all
</Files>

in httpd.conf it will block all users from seeing any file or folder where it reg exp matches "Audio" to any file/folder name.

However I want the opposite to occur. It should block every file/folder from view, apart from my Audio folder in the directory root. And rather than enter a seperate <file> and <folder> entry for every other folder in the directory

Reply With Quote
  #5  
Old January 30th, 2009, 08:29 AM
jamestrowbridge jamestrowbridge is offline
Contributing User
Click here for more information.
 
Join Date: Jul 2008
Location: Cleveland, Ohio, USA
Posts: 411 jamestrowbridge User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 18 h 54 m 24 sec
Reputation Power: 2
Would you just need two? I'm not very good with .htaccess files, but from what Llama says- it seems like you would only need one in the root and then one in the Audio folder - Audio folder allow and root deny...

Reply With Quote
  #6  
Old January 30th, 2009, 08:56 AM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
maybe, I'll try later, see if that does what I'm after

Reply With Quote
  #7  
Old January 30th, 2009, 10:11 AM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
yes, if you wanted to deny access to the root and allow to the audio you should be able to just use two .htaccess, one with deny from all in the root and one with allow from all in /audio/

Reply With Quote
  #8  
Old January 30th, 2009, 12:45 PM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
The only problem with that way is that when I go to root it just shows the "You don't have permission to access / on this server." error. However If I manually go to localhost/audio then I get access.

What I am trying to do is have this happen, this is without an changes to the httpd.conf file.

Index of /

* Andy Stuff/
* Audio/
* Basic Test/
* Codewalkers/
* Dungeon Master/
* Mail Tests/
* Misc/
* Temp/
* XML/
* phpinfo.php
* pulse_fw3324.exe

and this is what Im trying to do have happen is to get

Index of /

* Audio/

for all users but me, I know I can put a .ht access in every other folder to establish this, but Im sure it could be done in the .conf file instead

Reply With Quote
  #9  
Old January 30th, 2009, 02:47 PM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
Ok, getting somewhere now, what I have done is put in

<Directorymatch "^(D:/Olympus/PHP Files/)[B-Z]">
order deny,allow
deny from all
</Directorymatch>

and

<Files "index.html">
order deny,allow
allow from all
</Files>

The second cos otherwise I can't access the server generally.

The first one blocks all folders which don't begin with A (for Audio). Now Im trying to get it to go on the second letter so I've tried adding [a-t|v-z] allowing u (the second letter of Audio). But that doesn't work for some reason, infact it seems to bring back an entry with u as the second entry. I presume becuase the reg exp keeps running through the expression for other matches?

Reply With Quote
  #10  
Old February 1st, 2009, 04:08 AM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
ok, not quite sure why this works but it does

<Directorymatch "^(D:/Olympus/PHP Files/).{4}[^(o)]">

thankfully Audio is the only folder with o as the fifth letter in the directory

Reply With Quote
  #11  
Old February 2nd, 2009, 05:41 PM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
why can't you just use:

<Directorymatch "^D:/Olympus/PHP Files/audio">

Reply With Quote
  #12  
Old February 3rd, 2009, 11:27 AM
Osiris Osiris is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: May 2008
Location: Sussex
Posts: 566 Osiris User rank is Private First Class (20 - 50 Reputation Level)Osiris User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 33 sec
Reputation Power: 2
That just blocks the audio folder, whereas I am trying to block everythingb but the audio file

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Apache - Directory / File Regexps


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek