Apache 2, quickly protect directory with password: Difference between revisions
From Andreida
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
* add further users without -c |
* add further users without -c |
||
htpasswd /etc/apache2/.passwd othername |
htpasswd /etc/apache2/.passwd othername |
||
* restrict access to the webserver (research the correct values for your system) |
|||
cd /etc/apache2 |
|||
chown www-data:www-data .passwd |
|||
chmod 600 .passwd |
|||
cd /<path-to-your-.htaccess-file> |
|||
chown www-data:www-data .htaccess |
|||
chmod 600 .htaccess |
Latest revision as of 15:02, 20 November 2020
- Create file with encrypted password
htpasswd -c /etc/apache2/.passwd yourname
- Create file ".htaccess" in folder to protected (subfolders are protected too)
AuthUserFile /etc/apache2/.passwd AuthType Basic AuthName "protecting work in progress" Require valid-user
- add further users without -c
htpasswd /etc/apache2/.passwd othername
- restrict access to the webserver (research the correct values for your system)
cd /etc/apache2 chown www-data:www-data .passwd chmod 600 .passwd
cd /<path-to-your-.htaccess-file> chown www-data:www-data .htaccess chmod 600 .htaccess