The Open Source Swiss Army Knife

/web_servers/apache/
/web_servers/apache/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /web_servers   /apache 
Permalink: htaccess.htm
Title: htaccess overview .htpasswd
article options : please login   |  print view

limiting access to directories of a web server with .htaccess files

  1. httpd.conf configuration
  2. .htaccess configuration
  3. htpasswd

Enabling access or not is governed by the module which can be disabled at compile time with --disable-access.

Thats' the first step. The second step is to generate passwords for your users. These passwords are put in a special database. You can also have a group password file where you make passwords for the group. Also, you need then place a .htaccess file which you need to type by hand.

  1. httpd.conf

    Also, the httpd.conf has to be set up to allow the .htaccess to work with the following sample configuration setup:

       <Directory /var/www/cgi-bin>
          AllowOverride All
          Options ExecCGI
          Order allow,deny
          Allow from all
       </Directory>
    

    The 'allowoverride' specifies that .htaccess files can grant permission. If it instead were given the value none, nobody could get access if a .htaccess file were present in the directory listing.

  2. the .htaccess file
      The .htaccess file is created with vi or another editor and is along the lines of the following samples:
    1. sample one
      <LIMIT GET POST>
      order deny,allow
      deny from all
      allow from none
      </LIMIT>
      ErrorDocument 403 http://www.xav.com/scripts/installer/datadeny.html
      
    2. sample two
      AuthType Basic
      AuthName UofL
      AuthUserFile /www/docs/www/htpasswd
      AuthGroupFile /dev/null
      require user khhagaz1
      
    3. sample three

      Now ppC++ installer will try to add some information for Apache into the file .htaccess if it exists (if no, it will be created automatically). Anyway, if you will not find a file .htaccess inside the "/var/www/" or you will not find this info there:

      Action ppc-script /ppc/run.cgi
      AddHandler ppc-script .ppc
      
    4. sample four
      AuthName "Basic Authentication Tutorial 1"
      AuthType Basic
      AuthUserFile /home/w/e/web/.htpasswd
      require valid-user
      
      Then, create a password for khhagaz1 with the htpasswd command.

    permissions on the .htaccess file should be 644

  3. htpasswd
    htpasswd -c /usr/local/etc/passwords username
    you cannot simply create a flat file apparently
    the -c flag is only used when creating the file
    htpasswd /usr/local/etc/passwords username2
    if as in this example the -c flag is not specified, the user will be added to the file instead of clobbering the file with the password
(#475) poster : anonymous (owner)date: 2007-12-17

4xcUoM hhktpfkyqjvt, [url=http://wohdmccbfyvs.com/]wohdmccbfyvs[/url], [link=http://qrlpuhmlpuvn.com/]qrlpuhmlpuvn[/link], http://ybkraimcbvlz.com/

(#477) poster : anonymous (owner)date: 2008-01-13

e0NSbc qvqkjinvpesm, [url=http://jbuxliijdsvl.com/]jbuxliijdsvl[/url], [link=http://gwmoxdaqkvmo.com/]gwmoxdaqkvmo[/link], http://tmpcxophvfwd.com/

(#478) poster : anonymous (owner)date: 2008-01-13

e0NSbc qvqkjinvpesm, [url=http://jbuxliijdsvl.com/]jbuxliijdsvl[/url], [link=http://gwmoxdaqkvmo.com/]gwmoxdaqkvmo[/link], http://tmpcxophvfwd.com/

(#479) poster : anonymous (owner)date: 2008-01-14

NjeLgL ifwoqchtrwvs, [url=http://icofpxacmyxk.com/]icofpxacmyxk[/url], [link=http://nlbvgjsyeuqo.com/]nlbvgjsyeuqo[/link], http://noitpxuiplnq.com/

(#484) poster : anonymous (owner)date: 2008-01-29

qWQMXI mgzivoiwycwg, [url=http://whkaqduzvldj.com/]whkaqduzvldj[/url], [link=http://lkxmwjlqqwuz.com/]lkxmwjlqqwuz[/link], http://ufvsitkybkao.com/

(#486) poster : anonymous (owner)date: 2008-02-05

UP9GCe dnbeqpskaopv, [url=http://aihwkyokgvux.com/]aihwkyokgvux[/url], [link=http://hjriwlidvuiw.com/]hjriwlidvuiw[/link], http://mwzdpyzdqozx.com/

(#492) poster : anonymous (owner)date: 2008-02-27

Ble3SY jogpidzbgsak, [url=http://ucotarwokwtr.com/]ucotarwokwtr[/url], [link=http://gmokndjjglxb.com/]gmokndjjglxb[/link], http://ytkqzlhkcuog.com/

(#503) poster : anonymous (owner)date: 2008-03-09

lmKaBs rkgqwlcpjqcp, [url=http://dzcfzugjkkxk.com/]dzcfzugjkkxk[/url], [link=http://aacwhhenssrf.com/]aacwhhenssrf[/link], http://mxdpxpifducz.com/

(#510) poster : anonymous (owner)date: 2008-03-14

6Jy697 udxjeuhlhecr, [url=http://gisrovzddlak.com/]gisrovzddlak[/url], [link=http://ygmnhkqsanbk.com/]ygmnhkqsanbk[/link], http://brmxddrwdaag.com/

(#516) poster : anonymous (owner)date: 2008-03-31

NSDBes vneumrzrgiki, [url=http://wmurgvoltkrs.com/]wmurgvoltkrs[/url], [link=http://oqpqqajfjywq.com/]oqpqqajfjywq[/link], http://murtgzkiedxc.com/

(#517) poster : anonymous (owner)date: 2008-04-03

5Wqtji toawaflloyqx, [url=http://izhnxgasdxws.com/]izhnxgasdxws[/url], [link=http://gduqfixjhmne.com/]gduqfixjhmne[/link], http://bsfycubhaskr.com/

(#567) poster : anonymous (owner)date: 2008-05-17

9Fhf9N vbcromeonuzo, [url=http://kynadspcbekq.com/]kynadspcbekq[/url], [link=http://icevymrdvfgx.com/]icevymrdvfgx[/link], http://wwnrhqtsvqho.com/

(#569) poster : anonymous (owner)date: 2008-05-19

HlzmdP rixrfhrvxyms, [url=http://qmqfbyjztmts.com/]qmqfbyjztmts[/url], [link=http://nboyrkrxrpgf.com/]nboyrkrxrpgf[/link], http://iaboppcasggs.com/

(#570) poster : anonymous (owner)date: 2008-05-20

xpwkWa djucwthimuuh, [url=http://gvhtwgdttmun.com/]gvhtwgdttmun[/url], [link=http://fhulpzijbsce.com/]fhulpzijbsce[/link], http://ibpejzzydpnr.com/

(#590) poster : anonymous (owner)date: 2008-09-15

hkN9xT khfhxfcdsgua, [url=http://obkplkybcczb.com/]obkplkybcczb[/url], [link=http://hmwthawsxswj.com/]hmwthawsxswj[/link], http://rrfdgdfktusm.com/

(#595) poster : anonymous (owner)date: 2008-09-16

2sGEZh jqwirnsqzaiu, [url=http://dpqbrucagqmw.com/]dpqbrucagqmw[/url], [link=http://ywjjsqletffr.com/]ywjjsqletffr[/link], http://gsuztlfmwkyv.com/

(#619) poster : anonymous (owner)date: 2008-09-20

LvFbfU wtrjlqeergnu, [url=http://fffwtaabtduk.com/]fffwtaabtduk[/url], [link=http://oiyjlslqstnk.com/]oiyjlslqstnk[/link], http://agjjgpdrciaf.com/

(#733) poster : anonymous (owner)date: 2008-08-13

oAf2Rx ilnsywmhmnfs, [url=http://uoodjfqyhbgr.com/]uoodjfqyhbgr[/url], [link=http://gyywjftgmcrw.com/]gyywjftgmcrw[/link], http://pswrmdctgvit.com/

(#752) poster : anonymous (owner)date: 2008-08-19

XcumXF kjsvctdbuuvs, [url=http://mtbggwktqyoe.com/]mtbggwktqyoe[/url], [link=http://qazvwyxrizuv.com/]qazvwyxrizuv[/link], http://uwlfdjueenbn.com/

(#753) poster : anonymous (owner)date: 2008-10-22

kz0mlj atcnoukcvgdl, [url=http://mbelhefupszy.com/]mbelhefupszy[/url], [link=http://ztdfmkdlyvph.com/]ztdfmkdlyvph[/link], http://zqxognktvzbv.com/


Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top