[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1439
  • Last Modified:

How to create password protected directory

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
Maggie_li
Asked:
Maggie_li
  • 5
  • 2
1 Solution
 
periwinkleCommented:
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
 
Maggie_liAuthor Commented:
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
 
periwinkleCommented:
Maggie -

I was able to click on both links above???  Which one did you have problems with?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
periwinkleCommented:
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
 
periwinkleCommented:
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
 
Maggie_liAuthor Commented:
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
 
periwinkleCommented:
Hi Maggie -

Glad to be of help!

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now