﻿{"id":414,"date":"2011-07-12T10:20:39","date_gmt":"2011-07-12T10:20:39","guid":{"rendered":""},"modified":"2011-11-18T16:37:15","modified_gmt":"2011-11-18T08:37:15","slug":"414","status":"publish","type":"post","link":"http:\/\/zerobox.org\/notes\/414.html","title":{"rendered":"apache htpasswd\u547d\u4ee4"},"content":{"rendered":"<p><strong>apache htpasswd\u9009\u9879\u53c2\u6570<\/strong><\/p>\n<p>htpasswd [-cmdpsD] passwordfile username<\/p>\n<p>htpasswd -b[cmdpsD] passwordfile username password<\/p>\n<p>htpasswd -n[mdps] username<\/p>\n<p>htpasswd -nb[mdps] username password<\/p>\n<p><strong>apache htpasswd\u547d\u4ee4\u9009\u9879\u53c2\u6570\u8bf4\u660e<\/strong><\/p>\n<p>-c \u521b\u5efa\u4e00\u4e2a\u52a0\u5bc6\u6587\u4ef6<\/p>\n<p>-n \u4e0d\u66f4\u65b0\u52a0\u5bc6\u6587\u4ef6\uff0c\u53ea\u5c06apache htpasswd\u547d\u4ee4\u52a0\u5bc6\u540e\u7684\u7528\u6237\u540d\u5bc6\u7801\u663e\u793a\u5728\u5c4f\u5e55\u4e0a<\/p>\n<p>-m \u9ed8\u8ba4apache htpassswd\u547d\u4ee4\u91c7\u7528MD5\u7b97\u6cd5\u5bf9\u5bc6\u7801\u8fdb\u884c\u52a0\u5bc6<\/p>\n<p>-d apache htpassswd\u547d\u4ee4\u91c7\u7528CRYPT\u7b97\u6cd5\u5bf9\u5bc6\u7801\u8fdb\u884c\u52a0\u5bc6<\/p>\n<p>-p apache htpassswd\u547d\u4ee4\u4e0d\u5bf9\u5bc6\u7801\u8fdb\u884c\u8fdb\u884c\u52a0\u5bc6\uff0c\u5373\u660e\u6587\u5bc6\u7801<\/p>\n<p>-s apache htpassswd\u547d\u4ee4\u91c7\u7528SHA\u7b97\u6cd5\u5bf9\u5bc6\u7801\u8fdb\u884c\u52a0\u5bc6<\/p>\n<p>-b \u5728apache htpassswd\u547d\u4ee4\u884c\u4e2d\u4e00\u5e76\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u800c\u4e0d\u662f\u6839\u636e\u63d0\u793a\u8f93\u5165\u5bc6\u7801<\/p>\n<p>-D \u5220\u9664\u6307\u5b9a\u7684\u7528\u6237<\/p>\n<p>\u5728Windows, NetWare and TPF \u7cfb\u7edf\u4e2d \u2018-m\u2019\u9009\u9879\u662f\u9ed8\u8ba4\u7684\uff0c\u5728\u4f7f\u7528apache htpasswd\u547d\u4ee4\u65f6\u53ef\u4ee5\u5ffd\u7565\u3002\u5728\u5176\u4ed6\u7cfb\u7edf\u4e2d\uff0c\u2019-p\u2019\u9009\u9879\u53ef\u80fd\u4e0d\u80fd\u5de5\u4f5c\u3002<\/p>\n<p><strong>apache htpasswd\u4f8b\u5b50<\/strong><\/p>\n<p>1\u3001\u5982\u4f55\u5229\u7528htpasswd\u547d\u4ee4\u6dfb\u52a0\u7528\u6237\uff1f<\/p>\n<p>htpasswd -bc .passwd tonyzhang pass<\/p>\n<p>\u5728bin\u76ee\u5f55\u4e0b\u751f\u6210\u4e00\u4e2a.passwd\u6587\u4ef6\uff0c\u7528\u6237\u540dtonyzhang \uff0c\u5bc6\u7801\uff1apass\uff0c\u9ed8\u8ba4\u91c7\u7528MD5\u52a0\u5bc6\u65b9\u5f0f<\/p>\n<p>2\u3001\u5982\u4f55\u5728\u539f\u6709\u5bc6\u7801\u6587\u4ef6\u4e2d\u589e\u52a0\u4e0b\u4e00\u4e2a\u7528\u6237\uff1f<\/p>\n<p>htpasswd -b .passwd onlyzq pass<\/p>\n<p>\u53bb\u6389c\u9009\u9879\uff0c\u5373\u53ef\u5728\u7b2c\u4e00\u4e2a\u7528\u6237\u4e4b\u540e\u6dfb\u52a0\u7b2c\u4e8c\u4e2a\u7528\u6237\uff0c\u4f9d\u6b64\u7c7b\u63a8<\/p>\n<p>3\u3001\u5982\u4f55\u4e0d\u66f4\u65b0\u5bc6\u7801\u6587\u4ef6\uff0c\u53ea\u663e\u793a\u52a0\u5bc6\u540e\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1f<\/p>\n<p>htpasswd -nb tonyzhang pass<\/p>\n<p>\u4e0d\u66f4\u65b0.passwd\u6587\u4ef6\uff0c\u53ea\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa\u7528\u6237\u540d\u548c\u7ecf\u8fc7\u52a0\u5bc6\u540e\u7684\u5bc6\u7801<\/p>\n<p>4\u3001\u5982\u4f55\u5229\u7528htpasswd\u547d\u4ee4\u5220\u9664\u7528\u6237\u540d\u548c\u5bc6\u7801\uff1f<\/p>\n<p>htpasswd -D .passwd tonyzhang<\/p>\n<p>5\u3001\u5982\u4f55\u5229\u7528htpasswd\u547d\u4ee4\u4fee\u6539\u5bc6\u7801\uff1f<\/p>\n<p>htpasswd -D .passwd tonyzhang<\/p>\n<p>htpasswd -b .passwd tonyzhang pass<\/p>\n<p>\u5373\u5148\u4f7f\u7528htpasswd\u5220\u9664\u547d\u4ee4\u5220\u9664\u6307\u5b9a\u7528\u6237\uff0c\u518d\u5229\u7528htpasswd\u6dfb\u52a0\u7528\u6237\u547d\u4ee4\u521b\u5efa\u7528\u6237\u5373\u53ef\u5b9e\u73b0\u4fee\u6539\u5bc6\u7801\u7684\u529f\u80fd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>apache htpasswd\u9009\u9879\u53c2\u6570 htpasswd [-cmdpsD] p &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/zerobox.org\/notes\/414.html\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[54],"class_list":["post-414","post","type-post","status-publish","format-standard","hentry","tag-apache-htpasswd"],"views":891,"_links":{"self":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/comments?post=414"}],"version-history":[{"count":0,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/414\/revisions"}],"wp:attachment":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/media?parent=414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/categories?post=414"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/tags?post=414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}