Saturday, 21 October 2017  
2.4 Password Protecting Web Directories

QUICK TIP: If you are a FrontPage user, you should use the password protection tool that comes with FrontPage EXCEPT when password protecting your webstats directory.  More detail

IMPORTANT: You will need to use both FTP and SSH to use this feature. This means if you have Value Plan, you wouldn't be able to use this feature.

2.4.1. Using .htaccess

Suppose your domain name is foobar.com and want to password protect http://foobar.com/members/  you would need to do the following:

1) Using a text editor such as Notepad in your local PC, create a file called ".htaccess".  Note that there is a period in front of htaccess. The file should contain following lines:

---COPY EVERYTHING BELOW--------------------
AuthUserFile /home/foobar/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET POST>
require user Spock
</Limit>

---COPY UP TO THE LINE ABOVE---------------

IMPORTANT: DON'T forget to replace "foobar" with your own domain name. Please don't include .com or .net extensions.

2) Save the file in plain text.

3) Upload the file via FTP to /www/foobar/member/   Make sure you are uploading it in ASCII (plain text) mode.

4) Log onto your account on our server via SSH.

5) Type following line at the command prompt and hit return:

htpasswd -c /home/foobar/.htpasswd Spock

This will create a file named .htpasswd in your home directory.

6) you will be prompted to type in the password for Spock.

7) Let's say you want to add another user called Kirk.
8) Type folling line at the command prompt and hit return:

htpasswd /home/foobar/.htpasswd Kirk

9) You would then add "require user Kirk" to your .htaccess.  It would look like this:

---COPY EVERYTHING BELOW--------------------
AuthUserFile /home/foobar/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET POST>
require user Spock
require user Kirk
</Limit>

---COPY UP TO THE LINE ABOVE---------------


10) That's it. Test it by visiting http://foobar.com/member/ You will be prompted to enter username and password.

2.4.2 Adding Additional Users and Passwords pairs

1) Again SSH to your account.

2) Type following line at the command prompt and hit return:

htpasswd /home/foobar/.htpasswd Sulu

IMPORTANT: DON'T forget to add "require user Sulu" to your .htaccess file.

3) You may reuse existing user/password combinations that you created in your .htpasswd file to allow access other password protected directories -- just use the right user name in the .htaccess file.

IMPORTANT: You should store the .htpasswd file in your home directory so it is hidden from others.

 

Latest Updates

This is to inform you that our business have been succeeded by Loyal Software Private Limited with effect from 01 Oct 2011. We hope that M/s Loyal Software Private Limited will continue to provide the same high quality products and service.
Domain Name Availability
Most Popular Extensions ::
com net org
info biz us
in name co.in
» More Extensions
 
Domain
Registration
.com, .net, .org,
.biz, .info, .name,
.org.in, .co.in, .net.in
»Details«
 
Web
Hosting
Linux Hosting &
    Windows Hosting
»Details«
 
Web
Design
PHP, ASP,
      JSP, .NET, ...
»Details«
 
Search Engine
Optimization
Google, Yahoo,
         MSN, Ask, ...
»Details«
Privacy Policy | Terms of Service | Site Map | Disclaimer Policy | Cancellation and Refund Policy
Copyright © 2010 Penta Infoway, All Rights Reserved.