Posted on Sunday, 31st May 2009 by Balazs

Authentication in Apache is done through htaccess, either from the configuration file, or from the .htaccess file in a given directory. Note that only full directories can be easily protected with this method.
Here is how: (first log in to the shell, as this method only works if
you have shell access)

$ cd .../html/protected_dir

$ cat > .htaccess

AuthType Basic

Authname "Protected KLC directory"

AuthUserFile ../../control/htpasswd

AuthGroupFile /dev/null

Require valid-user

+d

$ htpasswd -c ../../control/htpasswd user_name

[give passwd]

After the file is created for the first time, to
add more users:

$ htpasswd ../../control/htpasswd user_name

There are also more sophisticated authentication schemes available, that allow database driven authentication. Feel free to contact me for more information about those solutions.

Share and Enjoy:
  • Print
  • LinkedIn
  • Facebook
  • FriendFeed
  • Twitter
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • Slashdot
  • Yahoo! Buzz
  • Yahoo! Bookmarks
  • RSS
  • Ping.fm
  • email
  • PDF

Tags: , ,
Posted in Technology | Comments (Comments)

blog comments powered by Disqus