print this page  

sales@clickcom.com 

704-365-9970 

704-365-8770 
Medical Website Services
Home
Services
Support
DNS/Name Server Information
DSN Request Form
DNS Changes
DNS Transfer to Clickcom
FTP
WS_FTP
Email Support
Terms of Service
Password Protecting Your Site
File Transfer
Training
About Us
Partners
Testimonials
Contact Us
Featured Sites

Directions for:
Password Protection On Your Site...

If you are hosted on an Microsoft Windows-based machine, you will need to contact us at http@clickcom.com

READ FIRST, DIRECTIONS WILL FOLLOW
You create a new directory within your file space at the /home/yourusername/WWW/yourdomain.com/ location where you can store a file with user names and encrypted passwords. Then you will put a local access control file (a text file which must be named ".htaccess") within each directory that you want to control. This control file contains a list of the users who may access this directory and any sub-directories below it. You will define different sets of users who may access individual directories within your site.


NOTE: DO NOT keep the password file in any of the directories that contain web documents.

 
 

1. Log on to your server using telnet. (this service is turned on when requested, by default you will not have telnet access) 2. Go to your web directory. This is the WWW directory in your space. cd /home/username/WWW/domainname.com/ 3. First we will create a directory called "passwords" for your password file .Then we will create a directory that will be password protected. In this example, we will demonstrate using a directory called "protected" for the files we wish to protect. mkdir passwords mkdir yourdomain.com/protected 4. Set the user permissions for the new directories. chmod 755 passwords chmod 755 yourdomain.com/data/protected In the following examples, we create two users named “bob" and "john" and give them access to the new directory "protected". 5. Run the "htpasswd" program by typing htpasswd at the command prompt to create a password control file and add users and passwords. htpasswd -c passwords/users bob The "-c" parameter instructs htpasswd to create a new file, in this case called "users" and placed inside the "passwords" directory you just created. You only use the "-c" parameter the first time you create the file. To create additional users, you run the "htpasswd" program exactly the same way, using the same "passwords/users" file name, but leave out the "-c" parameter. Step 6 will demonstrate this.. htpasswd will prompt you to give a password for each user you add. The password will not show on screen as you type it. You will also be asked to re-type the password, to make sure you got it right. 6. Add another user to the password control file. htpasswd passwords/users lucky 7. Create local access control file(s) as plain text (ASCII) and name it/them ".htaccess" (if you are protecting multiple directories, all of the control files will have the same name, but each will be placed within the directory it controls). You may find it easiest to create your ".htaccess" files using a word processor on your own computer, and then use ftp to transfer the files to the appropriate directories on the server, just as you transfer your web documents. NOTE: The dot at the front of ".htaccess" is significant, and required! Here is the complete ".htaccess" file:

AuthName My Protected Files
AuthType Basic
AuthUserFile /home/yourusername/WWW/yourdomain.com/passwords/users

require valid-user

Make sure you get upper case and lower case right, and put spaces where they belong! The only thing you may want to change is the entry next to "AuthName" (which can be any text you would like to see in the dialog box that pops up when someone attempts to access the protected directory... and of course the location of the file to fit your username and site-name. 8. Transfer the ".htaccess" file(s) to the appropriate directory(s) if you have not already done so, and set the permissions for the file(s). chmod 644 data protected/.htaccess Note that the permissions you set for the ".htaccess" file are different than the permissions you set for the "passwords" and HTML directories (such as "protected" in this example). 9. You are done. Now just move HTML files and documents into the protected directories you have set up.