LexiConn Knowledgebase

Knowledgebase Home | Favorites Knowledgebase Home | Favorites
Search the Knowledgebase Browse by Category
Manually Setting Up Password Protected Directories
Article Details

Last Updated
9th of July, 2008

User Opinions (5 votes)
80% thumbs up 20% thumbs down

How would you rate this answer?
Helpful
Not helpful

This example shows how to password protect a directory and only allow access to a user named 'pumpkin' and to set/require a password for pumpkin.

Using SSH:

If your home directory is your login, create a file named .htaccess in your web directory that contains the following:

AuthUserFile /home/yourlogin/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic

require user pumpkin

Then in your home directory, type:

pumpkin:~$  htpasswd -c .htpasswd pumpkin

This will enable you to secure the directory so that only user pumpkin can enter this directory. Lastly, you must place the .htaccess file in the directory which is to be password protected.

You may want any of the user/password combinations you created in your .htpasswd file to allow access. Just change 'require user pumpkin' to 'require valid-user' (without the quotes, of course) in .htaccess and any of the users you created will be able to access the files.

Note that you want to store the .htpasswd file in your home directory so it is hidden from others. The one drawback to putting your .htpasswd file in your home directory is that you will have to slightly lower the security of your home directory. Go to /home and type chmod +x yourlogin. The web server needs execute permission on to read the .htpasswd file.


Related Articles
Attachments
No attachments were found.

Powered by Interspire Knowledge Manager Knowledgebase Software