Techheadz Tips and Tutorials
Techheadz@Twitter
Enter Search Term
ID: 212 Category: Apache Date Posted: 12/12/2011 Page Impressions : 936
0
Print Password protect a directory on your webspace

Password protect a directory on your webspace

I wanted to password protect a folder on my webspace. Unfortunately my hosts did not provide this as a function on my hosting control panel. Setting up a password protected folder is quite straight forward. The first thing you need to do is create an .htaccess file.

Create an .htaccess file and enter the following code.
AuthUserFile /home/user/www/.htpasswd
AuthName ProtectedArea
AuthType Basic
<Limit GET POST>require valid-user</Limit>
1) Change the AuthUserFile to the path on your own server.
2) Change the AuthName to whatever you want. No spaces
3) Save the file .htaccess

As you can the AuthUserFile points to a file called .htpasswd

As the name suggests this is where your username and password will be stored. The next thing we need to do is create the .htpasswd.

To generate the password you may need to visit a website.
I found the following site at http://www.htaccesstools.com/htpasswd-generator/

Enter the username and password.
Copy the code on the next page. The username and password is in the following format.
test:$apr1$lwFL0YZG$Nps4uKqMX8.QDu2wXk.C51
Now that you have copied the code, copy this in to a file and save it as a .htpasswd file.

You should now have two files. .htaccess and .htpasswd. Connect to your webspace and upload these to your root directory.

If everything was succesful you will be prompted for your username and password.


Related Apache Links

Generate a .htpasswd file



 
Search Techheadz
Ubuntu Ubuntu - Install Adobe Reader in Ubuntu 12.04. sudo apt-get install acroread
Ubuntu Ubuntu - Install veetle in Ubuntu
Ubuntu Ubuntu - Install Putty in Ubuntu
Ubuntu Ubuntu - Install gparted in Ubuntu. sudo apt-get install gparted
Ubuntu Ubuntu - Install Sopcast in Ubuntu Unity 12.04
Ubuntu Ubuntu - Ubuntu 12.04. Make Unity Launcher Icons Smaller.
MySQL MySQL - Import - Export MySQL using the terminal in Ubuntu Linux
Ubuntu Ubuntu - Ubuntu swappiness. Improve ubuntu performance. vm.swappiness=10. sysctl.conf
Ubuntu Ubuntu - Convert .ogv file to .mp4, .webm, .avi in Ubuntu using ffmpeg
Kubuntu Kubuntu - Install Adobe Reader in Kubuntu 12.10, Ubuntu 12.10
Ubuntu Ubuntu - Install filezilla in Ubuntu
Ubuntu Ubuntu - Install Google Chrome in Ubuntu 12.04
Ubuntu Ubuntu - Sendmail not found in Ubuntu. Send mail is slow.
Apache Apache - How to Start, Stop, Restart an Apache Web Server (Linux Ubuntu)
Ubuntu Ubuntu - Install Sopcast Player in Ubuntu 12.10
MySQL MySQL - MySQL commands list. MySQL using the terminal.
Ubuntu Ubuntu - VirtualBox Failed to access the USB subsystem. sudo usermod -aG vboxusers {username}
Ubuntu Ubuntu - Could not update ICEauthority file
CSS CSS - Stretch table width and height to 100% of screen using css and html
Ubuntu Ubuntu - How do I install a firewall in Ubuntu 12.10, ufw UncomplicatedFirewall
CSS CSS - How to set table to 100% screen height using CSS and HTML
Ubuntu Ubuntu - Nautilus Image Converter. Batch resize images in Ubuntu.
Ubuntu Ubuntu - Create a simple bash script in Ubuntu
Perl Perl - Install perl in Ubuntu
PHP PHP - session.save_path. Change the PHP session path
Search Techheadz
Install Adobe Flash in ubuntu 12.04
Install Adobe Flash in ubuntu 12.04
codecs for ubuntu 13.04
stop mail server in plesk
dreamweaver
linux radio streams
ffmpeg
The following packages have unmet dependencies. sopcast-player : Depends: sp-auth (>= 3.0.1) but it is not installable E: Unable to correct problems, you have held broken packages
dreamweaver
export mysql
settings kde
putty ubuntu
editor C++ in ubuntu
editor c++
php editor Ubuntu. Dreamweaver
ubuntu install total
ubuntu total
domain name
sopcast
ubuntu bash scripts

Binary Clock
http://www.binaryti.me/
Home | About | Links | Add Your Link | Most Popular | Last Accessed | Related Links | Twitter | Site Map
Apache | CSS | HTML | Javascript | Linux |MySQL | Perl | PHP | Linux News & Games | Retro Computing | Ubuntu | Mint | Kubuntu | Win