Rabu, 20 Mei 2009

directory Protect dengan htaccces & htpasswd

Ini digunakan untuk memprotect file yang ada pada /var/www . Bila file atau folder diakses dari luar, maka akan muncul request user name dan Password. Cara Setting Password :

1. Instal dahulu apache2 dari Synaptic Package manager
2. Kemudian buka file configurasi apache
root@user:~# nano /etc/apache2/sites-available/default

ganti isi yang ada di dalam config menjadi


Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all



3. Kemudian restart apache
root@user:~# /etc/init.d/apache2 restart
* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]

4. Langkah selanjutnya adalah membuat file di /var/www
root@user:~# cd /var/www/
root@user:~/var/www/#

5. buat dahulu directori yang akan di protect
root@user:~/var/www# mkdir rahasia
root@user:~/var/www# cd rahasia/
6. buatlah file .htaccess
root@user:~/var/www/rahasia# nano .htacces

7. masukkan file berikut

AuthName "MUNIR members only"
AuthType Basic
AuthUserFile /var/www/rahasia/.password
Require valid-user

8. kemudian save
9. buat file password dgn htpasswd & user pertama
root@user:/var/www/rahasia# htpasswd -c .password budi
New password:
Re-type new password:
Adding password for user budi
10.buat user kedua
root@user:/var/www/rahasia# htpasswd .password wati
New password:
Re-type new password:
Adding password for user wati
11.Cobalah masuk ke Firefox Browser kemudian masukkan localhost:rahasia/
maka akan muncul user name dan password


SILAHKAN MENCOBA N GOOD LUCK..

0 komentar :

Popular Posts

 
Design by NewWpThemes | Blogger Theme by Lasantha - Premium Blogger Themes | New Blogger Themes