Solved

How to create password protected directory

Posted on 2003-10-21
7
1,435 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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