Using ssh, log on to Bubba (as your regular user). Type
Code: Select all
su
to become root. The root password is
Code: Select all
excito
Code: Select all
nano /etc/apache2/sites-enabled/bubba
Code: Select all
<Directory /home/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Edit it in both places to:
Code: Select all
<Directory /home/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Now you need to restart the webserver.
Code: Select all
/etc/init.d/apache2 restart
Create a .htaccess file in the web catalog you want to password protect:
Code: Select all
nano /home/web/protectedfiles/.htaccess
A "standard" .htaccessfile could look something like:
Code: Select all
AuthType Basic
AuthName "Password Required"
AuthUserFile /etc/.passwords/.htpasswd
Require user user1
Save your .htaccessfile.
To password protect more catalogs simply create and place one .htaccessfile in every catalog you need to protect. Remember to change the user1 to whatever user you desire.
Create a catalog to place your password file in:
Code: Select all
mkdir /etc/.passwords
To create the file containing the passwords for the users, type:
Code: Select all
htpasswd -c /etc/.passwords/.htpasswd user1
You now have to enter a password for the user "user1".
To add more users in the .passwords file, leave out the -c parameter:
Code: Select all
htpasswd /etc/.passwords/.htpasswd user2
You now have to enter a password for the user "user2".
Open a web browser and brows to your protected catalog: www.yourbubba.com/protectedfiles
You should have to enter user name "user1" and your selected password.
That all! Any problems let me know.