Fixed: User/Pass With apache? or 3rd party?

Discussion in 'Windows Desktop Systems' started by lieb39, Jan 17, 2003.

  1. lieb39

    lieb39 Apple lover, PC User

    Messages:
    526
    Location:
    Australia
    Hello.

    I am wondering if it is possible in apache to edit the conf file so that for a certain directory (lets say http://localhost/private/ ) requires a password and a username, which is also stored in apache? Or even perhaps a sql table? I have seen this been used a lot, even on apache server. How would I go about setting this up?
     
  2. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    One way is to set Per Directory Options in the config file. Another way is to place a .htaccess file in the directory itself. There is info on how to do this on the Apache website and many other places throughout the Internet.
     
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  4. lieb39

    lieb39 Apple lover, PC User

    Messages:
    526
    Location:
    Australia
    Hmm I am trying to figure out how to use this command on windows... htpasswd -c /usr/local/apache/passwd/passwords username
    I tried doing this but it says that;
    C:\Program Files\Apache Group\Apache\bin>htpasswd c:\password\ lieb39
    Automatically using MD5 format on Windows.
    htpasswd: cannot modify file c:\password\; use '-c' to create it
    fopen: No such file or directory

    SO what do I do now?
     
  5. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Try:
    C:\Program Files\Apache Group\Apache\bin>htpasswd -c c:\password\passfile lieb39
     
  6. lieb39

    lieb39 Apple lover, PC User

    Messages:
    526
    Location:
    Australia
    Yay! I made a password file! Now I was reading the version 2 of apache's documents (I am running version 2...) and it said to create a file called ".htaccess" in the folder you wish to password protect. This is just a plain text file, with the following infomation in it (by the way, my password file is stored in "C:\program files\apache group\apache2\bin\passwd. " ;

    AuthType Basic
    AuthName "Resticted Files"
    AuthUserFile
    C:\program files\apache group\apache2\bin\passwd
    require user dlieb

    ; btw, i tried doing the location (c:\program files\..) in DOS format, in quotes, and like that.

    And when i go to that directory i just put this file in (http://localhost/private/) I just get the index.html page. Nothing pops up. What is wrong?

    I got all this infomation above from Apache Document v.2 (Direct link)

    Can anyone help me?:(
     
  7. lieb39

    lieb39 Apple lover, PC User

    Messages:
    526
    Location:
    Australia
    Fixed!

    Hello. I have fixed my problem after about 3 hours of troubleshooting it. I deleted apache 1.3 and installed the new apache, v.2. And did anyone know by default Apache blocks out .htaccess files. It simply ignores them. To fix this problem goto your httpd.conf file, look for this;
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    And chanage the None to All, so it looks like this;
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    Restart your sever, make sure your .htaccess file is in your directory, make sure your .htpasswd file is in there too and your .htaccess file is pointing to that file.

    All Done. Thanks Google!:rolleyes: :)