{"id":541,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=541"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"robin-hood-password-protecting-web-pages","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=541","title":{"rendered":"Robin Hood: Password-protecting web pages"},"content":{"rendered":"<p>If you&#8217;re serving a web site with the <a href=\"http:\/\/www.bebits.com\/app\/322\">Robin Hood<\/a> web server and want to password-protect specific areas of your site, don&#8217;t be confused into thinking that you need the <a href=\"\/chunga.php?ID=388\">RHDirectoryHandler<\/a> for this. Instead, you want to implement &#8222;Realms.&#8220;<br \/>\nThere is a small amount of documentation on realms in the RH docs, but you need to read carefully. The key words are &#8222;When a resource is requested <i>for which public access has not been granted<\/i> &#8230;&#8220;<br \/>\nThe trick here is that RH makes what use it can of Be&#8217;s multiuser filesystem, even though the OS isn&#8217;t yet multiuser. Therefore you can deduce that you need to modify permissions on the directories in question.<br \/>\nTo set this up, create a directory on your site called &#8222;realmtest&#8220;. Then, add a realm line to your <code>virtual_hosts<\/code> file, <i>under<\/i> the server definition (this is important because you can set up multiple servers from the same RH instance) that looks like this:<\/p>\n<pre>Realm: name=\"zero\" pattern=\"realmtest\" pattern=\"*\" user=\"foo\" passwd=\"bar\";<\/pre>\n<p>This will cause RH to search every URL request for the string &#8222;realmtest&#8220; (which is the directory name) and prompt for a user\/pass <b>if<\/b> public access has not been granted for that file or directory. To remove public access on the realmtest directory and the files it contains, open a Terminal and type:<\/p>\n<pre> cd &amp;lt;site_root&amp;gt; chmod -R a-r realmtest <\/pre>\n<p>(the -R flag on chmod tells it to change permissions on the directory and everything in it, recursively).<br \/>\nRestart the server. When someone tries to access a file in the realmest directory, they&#8217;ll be prompted for a username and password, which in this case would be user=foo, pwd=bar.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re serving a web site with the Robin Hood web server and want to password-protect specific areas of your site, don&#8217;t be confused into thinking that you need the RHDirectoryHandler for this. Instead, you want to implement &#8222;Realms.&#8220; There is a small amount of documentation on realms in the RH docs, but you need [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[2],"class_list":["post-541","post","type-post","status-publish","format-standard","hentry","tag-applications"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=541"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/541\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}