Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

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 Dev Shed Forums Sponsor:
  #1  
Old February 12th, 2003, 11:47 AM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
Password protect w/o .htaccess

Is there anyway to password protect a whole Unix directory without using .htaccess?
__________________
if (!$broke) {
dontFixIt();
}

Reply With Quote
  #2  
Old February 12th, 2003, 01:29 PM
Ctb's Avatar
Ctb Ctb is offline
An Ominous Coward
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2002
Posts: 4,425 Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 10 h
Reputation Power: 0
What do you mean? .htaccess files protect directory content from web users and nobody else. It's an Apache mechanism, not Unix. If you want to keep people out / only allow certain people in a directory, just use the file / directory permissions that Unix offers. All you have to do is chown and chmod the directory and / or its contents properly.

Reply With Quote
  #3  
Old February 12th, 2003, 02:21 PM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
Sorry, I meant Apache...

It needs to contain files that can be downloaded via HTTP, but only if they have proper credentials. But, I don't want this directory accessed directly (there has GOT to be a better way to say that...).

Probably sounds a little far fetched. I'll figure something out...

Reply With Quote
  #4  
Old February 12th, 2003, 03:41 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Quote:
Originally posted by epp_b
Sorry, I meant Apache...

It needs to contain files that can be downloaded via HTTP, but only if they have proper credentials. But, I don't want this directory accessed directly (there has GOT to be a better way to say that...).

Probably sounds a little far fetched. I'll figure something out...

Even if there is, htaccess is the most "correct" solution. It's what it was designed for doing. What's wrong with using htaccess?
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #5  
Old February 12th, 2003, 03:47 PM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 23 h 15 m 53 sec
Reputation Power: 19
You can do this by using sessions and a gatekeeper script on each page to be protected.

Reply With Quote
  #6  
Old February 12th, 2003, 03:50 PM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
Quote:
Originally posted by Strike
Even if there is, htaccess is the most "correct" solution. It's what it was designed for doing. What's wrong with using htaccess?


You're probably right. The only thing is that I need an HTML form that will use PHP to add and remove users from the .htpasswd file.

Reply With Quote
  #7  
Old February 12th, 2003, 03:53 PM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
Quote:
Originally posted by hedge
You can do this by using sessions and a gatekeeper script on each page to be protected.


This directory will contain other files (such as images) that need to be protected, so PHP sessions won't cut it. Thanks anyway

Reply With Quote
  #8  
Old February 12th, 2003, 08:43 PM
Ctb's Avatar
Ctb Ctb is offline
An Ominous Coward
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2002
Posts: 4,425 Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 10 h
Reputation Power: 0
Whoa mates... I'm not sure what's so tough about this...

It sounds to me like all you need to do is use htpasswd to set up a user list, then set up httpd.conf accordingly. For what you're doing, it doesn't sound like you'll even need to mess with .htaccess files. If you need a tutorial:

http://www.apacheweek.com/features/userauth

Incidentally... please post Apache questions in the Apache forum to help keep the place a little better organized.

Reply With Quote
  #9  
Old February 13th, 2003, 02:02 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> htaccess is the most "correct" solution. It's what it was designed for doing

Actually not. Instead, it was designed for just two things:

1) web users who don't have write access to httpd.conf
2) to do some very dynamic things without restarting the server

But mod_rewrite within httpd.conf can do the same equivalent tasks dynamically without restarting the server as well. Now there's only a single reason left.

Once again, if you have administrative access to httpd.conf you don't need to use .htaccess at all, as if there is no such thing in the Apache world.

Reply With Quote
  #10  
Old February 13th, 2003, 09:23 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Quote:
Originally posted by freebsd
Once again, if you have administrative access to httpd.conf you don't need to use .htaccess at all, as if there is no such thing in the Apache world.

Well I'll be damned - http://httpd.apache.org/docs/howto/htaccess.html#when

Reply With Quote
  #11  
Old February 13th, 2003, 09:33 AM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 23 h 15 m 53 sec
Reputation Power: 19
Quote:
Originally posted by epp_b
This directory will contain other files (such as images) that need to be protected, so PHP sessions won't cut it. Thanks anyway


Well it does still work, you just need to store binary data out of the tree. I think getting os security prompts is pretty hokey, It is much more professional to have a proper login.

Reply With Quote
  #12  
Old February 13th, 2003, 09:45 AM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
The .htpasswd file(s) that .htaccess will be using will require undergoing frequent changes (via PHP script), so this is the best solution. httpd.conf is probably out of the question anyways.

Reply With Quote
  #13  
Old February 13th, 2003, 10:36 AM
Ctb's Avatar
Ctb Ctb is offline
An Ominous Coward
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jan 2002
Posts: 4,425 Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level)Ctb User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 10 h
Reputation Power: 0
Quote:
The .htpasswd file(s) that .htaccess will be using will require undergoing frequent changes
All the more reason to CENTRALIZE your settings in httpd.conf, not splatter them all over the webspace with .htaccess files.

I'm having a very difficult time envisioning your need for .htacess here. Maybe you should tell us EXACTLY what you need to do. It sounds like you're going to try and frequently change the content that users may access rather than changing the users that may access the content (but not just remove the content from the webspace). Why?

Reply With Quote
  #14  
Old February 13th, 2003, 11:49 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> The .htpasswd file(s) that .htaccess will be using will require undergoing frequent changes (via PHP script)

Note, we are talking about .htaccess vs. httpd.conf.
Sound like you can't figure out how to go about writing such a PHP script and open+write to the .htpasswd file. If that's the case please go to the appropriate forum (PHP) and start a new thread. Not to mention discussing htaccess was OFF TOPIC here (Linux Forum) in the first place.

Reply With Quote
  #15  
Old March 16th, 2003, 03:55 PM
epp_b's Avatar
epp_b epp_b is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: La La Land
Posts: 145 epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level)epp_b User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 6 h 14 m 23 sec
Reputation Power: 7
Never mind, all -- I got it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Password protect w/o .htaccess


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread