martes, 1 de octubre de 2024

adding a pass to folder


Step 1: Enable .htaccess Usage


<Directory /var/www/html>

    Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted

</Directory>


2) sudo systemctl restart apache2


3) Install utils for pass file

 sudo apt-get install apache2-utils


4) Create pass file


  sudo htpasswd -c /etc/.htpasswd yourusername

5) Create a  .htaccess on the folder

cd /var/www/html/recordings

nano .htaccess

Add the following lines to the file:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/.htpasswd
Require valid-user

Test and  additional considerations


sudo chmod 644 /etc/.htpasswd
sudo chmod 644 /var/www/html/recordings/.htaccess

No hay comentarios:

Publicar un comentario