Password Protect Dir.....@#$%@#

  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

how can i password protect a directory/Folder in linux.I want to do it through PHP coding.But other suggestions are also welcome.Thanks to u all................
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

You did not mention, but I assumed, (as this is a webmaster forum) that it's a directory for web serving.
Apache directives, easiest being .htaccess.

See http://www.apache.org for more details.

Of course, having many of these can affect (degrade) performance, since it has to be parsed each time. So you could try the <Directory > entry in the httpd.conf.
<Directory /path /to /dir>
Options FollowSymLinks ExecCGI
Deny from all
Allow from 127.0.0.1
AllowOverride None
AuthName "Auth Realm Name"
AuthType Basic
AuthUserFile /path/to/passwd file
require valid-user
Satisfy any
</Directory>

You make the passwd file using the htpasswd program, supplied with Apache. See the man pages for details.
Cheers.
  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

Hi...
Daemonguy,its really nice on ur part that u replied to me.I have done it the way u told me.Its working fine.Ijust completed it today before reading ur post but it was a good answer and i appretiate ur initiation.
  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

Tannu4u wrote:
Hi...
Daemonguy,its really nice on ur part that u replied to me.I have done it the way u told me.Its working fine.Ijust completed it today before reading ur post but it was a good answer and i appretiate ur initiation.


No worries. Glad I could help.

Cheers.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.