First you'll have to do one of the following.
1. Change the documentroot so your apache site can see the 'int' directory. 
Your current documentroot is too specify as is to encompass both.
or
2. Create a new virtualhost with a documentroot of 
/var/www/html/int/<whatever>. If your original vhost is ext.domain.com, maybe 
this one should be int.domain.com. And have the link to the intranet point to 
int.domain.com

I would do #2 personally

Then, create a directory block in your vhost that you want to lock down and 
specifically the proper auth config.
For a basic authentication lockdown, you might have:

<Directory /var/www/html/int/main>
                AllowOverride None
                Order allow,deny
                Allow from all
                AuthType Basic
                AuthName "Secure Intranet site"
                AuthUserFile "/var/www/htpasswd/.int-htpasswd"
                require valid-user
</Directory>

Then, create the /var/www/htpasswd directory
Then, create your .int-htpasswd file
        htpasswd -s -c /var/www/htpasswd/.int-htpasswd some-username-to-create
Enter the password to create for the username specified on the command line.

Fix unix ownership/permissions on the htpasswd dir/file so only the apache 
user/group can read from the dir and file.
I usually do chown root.apache on them and then chmod 750 the dir and chmod 640 
the file, but YMMV
Reload apache.
Browse to your intranet site url.

-Tony
---------------------------
Manager, IT Operations
Format Dynamics, Inc.
303-573-1800x27
abia...@formatdynamics.com
http://www.formatdynamics.com


-----Original Message-----
From: Carlos Williams [mailto:carlosw...@gmail.com] 
Sent: Monday, February 23, 2009 10:41 AM
To: users@httpd.apache.org
Subject: [us...@httpd] How To Configure.htpasswd For Web Authentication

I have Apache2 up and running on my web server. My main goal is to
have a link on my index.html that links to my company Intranet.
Obviously I don't want everyone to be able to publicly browse my
Intranet so I am looking for a authentication method. I was advised to
use .htpasswd on Apache however I really have no idea where to begin.

DocumentRoot /var/www/html/ext/main

You can see the file structure below:

[r...@web ~]# cd /var/www/html/
[r...@web html]# ls -l
total 16
drwxr-xr-x 3 root root 4096 Feb 10 14:19 ext
drwxr-xr-x 2 root root 4096 Feb 19 16:38 int

My question is how to I have an authentication process using .htpasswd
if someone wants to access anything inside /var/www/html/int/*?

I have never done this before so I apologise in advance.

--
Carlos Williams
Linux System Administrator

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to