post your comment   print   send to a friend
Rate: 100% | Views: 3722
Question categories:  Unix Plans

How do I create .htpasswd file?

Answer by: Andrew Hickl, Aplus.Net Knowledge Base Support

If you plan to password protect directories using .htaccess files, you will need to create a working .htpasswd file first.  Here’s how:

*Begin by creating the .htpasswd file itself.

  1. Open up a text editor on your computer.  We recommend that you use Notepad (Windows), SimpleText (Macintosh), or Emacs (Linux / UNIX).
  2. Save the file (in an easy-to-find location) as .htpasswd (including the initial dot).
  3. Now, make sure that your text editor did not append a .txt suffix to the file name. (In Windows, you can do this by right-clicking the icon for the text file and selecting “Properties”.) If the file name does have a .txt suffix (i.e. ‘.htpasswd.txt’), remove the suffix by renaming the file.
  4. Before entering code into your new file, make sure that “Word Wrap” is turned off. (In Notepad, select “Format…” from the top navigation bar and make sure that “Word Wrap” is unchecked.

*You’re now ready to add some users.

  1. Begin by selecting the username that you will use to log-in to the protected directory. (Usernames can be between 2 and 16 characters long and should only contain lower-case letters and numbers.)
  2. Type the username into the .htpasswd file followed by a colon. Your file should look like this:

username:

  1. You’ll now need to encrypt the password that you will use to log-in to the directory. To do this, visit http://users.abac.com/cgi-bin/pass.pl.  On this page, enter your password (up to 13 characters) and hit the “Submit” button – the encrypted password will be displayed on the following page.
    Important:
    The encrypted password will always be 13 characters long, regardless of the actual length of your password.  
  2. Copy the encrypted password from the webpage and paste it into your .htpasswd file following the colon. Be sure to remove any spaces that may precede or follow the password. Your file should look like this:

username:WvePMzyciLRIo

  1. To add additional users, end the current line with a carriage return and repeat steps (5) through (8) above on the next line.
  2. When you’re done adding users, save the file.

*Uploading the .htpasswd File

  1. Open your FTP client and establish a connection to your web space using your FTP Username and FTP Password. Your connection URL should be www.yourdomainname.com (where ‘yourdomainname.com’ = the actual name of your domain).
  2. Browse to the root directory of your website. This is important: uploading your .htpasswd file to another directory may cause unexpected consequences.
  3. Set your upload settings to ASCII. (Uploading .htpasswd files in ‘binary’ format may have unexpected consequences.)
  4. Upload your .htpasswd file from your local computer. Be sure not overwrite an existing .htpasswd file – you may lose whatever login information is stored in that file.
    Important:
    If you have an existing .htpasswd file in your root directory, we suggest that you add the usernames and passwords contained in that file to your new .htpasswd file before uploading it to the web. You can do this by first downloading the old .htpasswd file and copying and pasting its content into your new file.
  5. After the upload is completed, you may need to change the file permissions for the .htpasswd file. They should be set to 644 (using chmod) or RW-R--R--.

Important: If you have a Windows-based hosting plan, you cannot use .htaccess files.

Customer Feedback
Rate: 100% | Views: 3722 | Please Rate:  
 
If you have other comments or ideas for future technical tips, please type them here:

Email: (optional)

Comments: (optional)

 Domain Name Registration | Web Page Design    Back to serch results
Browse the Base
Knowledge Base
Shared Hosting
  Unix Plans
    MySQL
Messages
 

Ea$y money.

Join Aplus.Net's NEW and improved affiliate program today and start earning cash with your web site. We turn clicks into cash. No fees .No restrictions .No earning limits .Checks mailed monthly. Full real time online reports.
Commission schedule

Private Area
 
Ask
in Private
   
Personal
Folder
 
Related Questions
 
1. I have a Unix-based shared hosting plan. How can I change permissions for files/directories using the File Manager?
 
2. How can I protect directories?
 
3. How to Set Up a Storefront ?
 
4. What are the permissions on files and directories?
 
5. In Unix, what is the find command, and how do I use it to search through directories for files?
 
Home Browse Search Ask in Private Personal Folder   Help
powered by web hosting 
  Logged as: Guest