{"id":373,"date":"2003-05-04T17:28:33","date_gmt":"2003-05-04T21:28:33","guid":{"rendered":"http:\/\/wordpress.cephas.net\/?p=373"},"modified":"2003-05-04T17:28:33","modified_gmt":"2003-05-04T21:28:33","slug":"user-level-security-in-apache","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2003\/05\/04\/user-level-security-in-apache\/","title":{"rendered":"user level security in apache"},"content":{"rendered":"<p>I needed to lock down a couple directories on this server using Basic Authentication in Apache&#8230; in case you&#8217;ve ever wanted too, or someday will need too:<\/p>\n<p>1) Add the username to the password file using the htpasswd module:<\/p>\n<p># htpasswd \/etc\/httpd\/users username<\/p>\n<p>where &#8216;\/etc\/httpd\/users&#8217; is the name of the file you want your users\/passwords stored and &#8216;username&#8217; is the username you want to add.  It&#8217;ll ask you for the password, and then again before adding the user to the file.  If the file doesn&#8217;t exist, usr the -c flag to create the file:<\/p>\n<p># htpasswd -c \/etc\/httpd\/users username<\/p>\n<p>2) Then add a .htaccess file in the directory you wan to secure that contains this:<\/p>\n<p>AuthName &#8220;username&#8221;<br \/>\nAuthType Basic<br \/>\nAuthUserFile \/etc\/httpd\/users<br \/>\nrequire user username<\/p>\n<p>where &#8216;\/etc\/httpd\/users\/&#8217; is the name your passwd file and &#8216;username&#8217; is the name of the user you want to allow in this directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed to lock down a couple directories on this server using Basic Authentication in Apache&#8230; in case you&#8217;ve ever wanted too, or someday will need too: 1) Add the username to the password file using the htpasswd module: # htpasswd \/etc\/httpd\/users username where &#8216;\/etc\/httpd\/users&#8217; is the name of the file you want your users\/passwords &hellip; <a href=\"https:\/\/cephas.net\/blog\/2003\/05\/04\/user-level-security-in-apache\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">user level security in apache<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/373"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=373"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/373\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}