Solved

How to create password protected directory

Posted on 2003-10-21
7
1,436 Views
Last Modified: 2010-03-04
hello, everybody?

Does anybody can teach me how to create a password protected directory at Sun Solaris system? My web server is Apache. any I donot have access to httpd.conf file. I guess I have t do this by using .htaccess file or is there any other solutions? THanks very much.

0
Comment
Question by:Maggie_li
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 9594341
Hi Maggie -

If you do not have access to the httpd.conf file, then you would do this via a .htaccess file (as long as your server admin has given you permission to do so).

There's a good basic article on this at:

http://www.apacheweek.com/issues/96-10-18#userauth

If you'd like a way of managing your password files without ssh or telnet access, you might consider using a program like Access Denied:

http://solutionscripts.com/warehouse/access_denied/index.shtml
0
 

Author Comment

by:Maggie_li
ID: 9606066
Thank you very much for your help, periwinkle.
but this is a broken link that I can not access it. Could you please give me more information about this topics? Thanks a lot.

0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9606185
Maggie -

I was able to click on both links above???  Which one did you have problems with?
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
LVL 15

Expert Comment

by:periwinkle
ID: 9606197
Here's another link to the Apache.org website that gives the information on .htaccess control:

http://httpd.apache.org/docs/howto/auth.html

0
 
LVL 15

Accepted Solution

by:
periwinkle earned 50 total points
ID: 9606274
Basically, to do user-based authentication, you create a file called .htaccess in the directory that you want to protect (be aware that subdirectories wil be protected as well).  In that file, you place directives:

AuthUserFile /full/path/to/.htpasswd
AuthName "some text you'd like to pop up - like Enter username and password for access to site"
AuthType Basic

<LIMIT GET POST PUT>
require valid-user
</LIMIT>

This refers to a file, which I've called .htpasswd in my example above (but can be called anything) that contains the usernames and passwords.  As you probably are aware, any file that begins with a period is a hidden file.  It's a good idea to put the htpassword file outside of the html hierarchy (if possible), and to start it with a period.

To create the password file, you need to either log on via ssh and use the htpasswd program (which is provided with the Apache distribution) to create the htpasswd file, or use a cgi program such as the Access Denied script that I've given above.

To use the htpasswd command utility, you will use the -c flag only the first time to create the file (if you continue to use it, it will overwrite the file, deleting any previous entries):

htpasswd -c .htpasswd username

it will then prompt you for the password (twice, to make certain that you have entered it properly).

On subsequent times, you'll just use:

htpasswd .htpasswd username
0
 

Author Comment

by:Maggie_li
ID: 9609781
periwinkle,

Thanks very much for your help. I got the problem figured out:-)

I have already accepted your comment as answer. Thanks again,
and have a nice day.

0
 
LVL 15

Expert Comment

by:periwinkle
ID: 9609959
Hi Maggie -

Glad to be of help!

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question