PDA

View Full Version : Password protecting a folder/website



leviwells
07-22-2008, 07:58 PM
working with passwording my website at www.leviwells.com and it worked great...


except that I only wanted to protect one folder and now cannot seem to undo what I have done..

grrrrrrr....!

help please..!:D

Falcon1986
07-22-2008, 09:50 PM
Are you password-protecting the public_html directory or a subdirectory within public_html?

You can use the cPanel wizard for password-protecting directories, or you can just create an .htaccess and an accompanying .htpasswd file.


IMPORTANT - these files start with a period which is required. There are no characters preceding the period. Use a simple text editor (e.g. Notepad or Notepad++) to create these files and when you are saving, ensure that the file type is set to "All files".

The contents of each should be as follows:

.htaccess - replace 'USERNAME' and 'Directory description' with your own Hostmonster username and directory description respectively.

AuthType Basic
AuthUserFile /home/USERNAME/public_html/.htpasswd
AuthName "Directory description"
require valid-user

If you need to specify a different folder for protecting, modify the 'AuthUserFile' line to reflect this.

.htpasswd - replace 'username' and 'uniquepassword' with your own information. Note the space between them and that each user and corresponding password are stated in a single line.

username1 uniquepassword1
username2 uniquepassword2

Finally, upload both files to your public_html directory and give them a chmod of 755 so that they are readable.

leviwells
07-23-2008, 12:10 AM
I was attempting to put a password on a sub folder within the public_html. but I messed up and the entire website is protected. I would like to know how to remove this protection.

Thanks Falcon

Falcon1986
07-23-2008, 12:49 AM
Access your public_html directory via FTP (or through your cPanel's File Manager). Standalone FTP applications such as FileZilla should not have a problem displaying hidden files by default, but you will need to activate this feature when using the File Manager (at the dialog box that first pops up). Files beginning with a period in the name are hidden files as far as Linux is concerned.

Locate the .htaccess and .htpasswd files and rename them to something like 1.htaccess and 1.htpasswd. Try visiting your site.

If there is anything important other than the password specification within your .htaccess file that you want to save then back it up before deleting from the server.

leviwells
07-23-2008, 06:28 AM
thank you. I will try that.