Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Apache2 Authentication Trouble

    I'm having trouble getting authentication working on my web server.

    I've created a symbolic link from a directory in my home directory.

    Basically, here's what I've tried:
    >cd /var/www
    >sudo ln -s /home/me/testdir testdir
    >ls -ltr
    lrwxrwxrwx 1 root root 21 2007-09-14 08:56 testdir -> /home/me/testdir//
    other files...
    >cd /home/me
    >htpasswd -c .htpasswd testuser
    password prompt> testpassword
    >cd /home/me/testdir
    >vi .htaccess
    AuthUserFile /home/me/.htpasswd
    AuthType Basic
    AuthName "Personal"
    Require valid-user

    Then, when I visit, I get right in without being prompted for authentication. I beleive I have everything setup correctly, but feel free to walk though anything you think I may be missing.

    I'm using Apache 2.2.3 on Ubuntu Fiesty.

    Thanks for the help.

  2. #2
    I noted that my /etc/apache2/httpd.conf is empty. That's probably my problem. I can't find a complete file online. Would someone mind posting theirs?

  3. #3
    Pull it off of a source from Apache's website. Give me a second and I will pull mine up and modify it to the best I can so that you can use it. I have modified mine a LOT so as it is would still give you problems.

  4. $spacer_open
  5. #4
    I'm just surprised that apache is serving the website with that file being empty.

  6. #5
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    North Carolina
    have you checked your apache logs for errors

    I also assume that apache has permissions to use the files from your directory, if not then give the persmisions.

    I don't really see anything that you have done wrong, as long as you have rebooted apache and also refreshed (or restarted) your web browser

    heres a guide that doesn't look much different from what you have done
    Protecting private directories with APACHE's .htaccess and htpasswd authorization.
    Apache Week. Using User Authentication

    after looking at the last link, I don't think you mentioned conf settings like AllowOverride AuthConfig for the specific directory

  7. #6
    Just today, I read that the httpd.conf is empty on Debian based systems (i.e. Ubuntu). The apache2.conf is supposedly where all the action happens.

    All that being said, authentication is still not working. I read that if AllowOverride is not set, it'll ignore all .htaccess files. So, I set it to ALL and am still having the problem.

  8. #7
    Found this and it fixed the problem. Posting it for any others who stumble on this problem.

    .htaccess is disabled by default on Ubuntu and Apache and this distro's config files are a little different.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts