{"id":878,"date":"2014-09-28T21:02:02","date_gmt":"2014-09-28T21:02:02","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2014\/09\/28\/how-to-password-protect-your-apache-webpages\/"},"modified":"2021-07-27T18:47:40","modified_gmt":"2021-07-27T18:47:40","slug":"how-to-password-protect-your-apache-webpages","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Security\/Tutorials\/how-to-password-protect-your-apache-webpages.html","title":{"rendered":"How to password protect your Apache webpages"},"content":{"rendered":"
There are times where you may require your webpages to be password protected.<\/p>\n
To achieve this within Apache the usernames and passwords are stored within a flat file called htpasswd. This is then referenced within your Apache configuration.<\/p>\n
Within your .htaccess file configure the following.<\/p>\n
AuthType Basic\r\nAuthName \"restricted area\"\r\nAuthUserFile \/var\/www\/html\/website\/.htpasswd\r\nrequire valid-user<\/pre>\nCreate htpasswd<\/h2>\n
Next we create the htpasswd file and create a user named support.<\/p>\n
[root@server \/]# cd \/var\/www\/html\/website\/\r\n[root@server website]# htpasswd -c .htpasswd support\r\nNew password: \r\nRe-type new password: \r\nAdding password for user support<\/pre>\nCreate additional User<\/h2>\n
An additional user is then created named bob.<\/p>\n
[root@server website]# htpasswd\u00a0 .htpasswd bob\r\nNew password: \r\nRe-type new password: \r\nAdding password for user bob<\/pre>\nRestart Apache<\/h2>\n
Finally Apache is restarted and you can then log into your webpage and confirm password authentication is working.<\/p>\n
systemctl restart httpd<\/pre>\n","protected":false},"excerpt":{"rendered":"There are times where you may require your webpages to be password protected. To achieve this within Apache the usernames and passwords are stored within a flat file called htpasswd. This is then referenced within your Apache configuration. Configure Apache Within your .htaccess file configure the following. AuthType Basic AuthName “restricted area” AuthUserFile \/var\/www\/html\/website\/.htpasswd require … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"yoast_head":"\n
How to password protect your Apache webpages - Fir3net<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n