最終更新:2024-01-09 (火) 11:46:24 (102d)  

htpasswd
Top / htpasswd

htpasswd [ -c ] [ -m ] [ -D ] passwdfile username

新規作成

htpasswd -c ファイル名 ユーザ名

追加

htpasswd ファイル名 ユーザ名

パラメータ

  • -b - Use batch mode
  • -c - create the passwdfile

バッチで追加

  • -b -Use batch mode; i.e., get the password from the command line rather than prompting for it. This option should be used with extreme care, since the password is clearly visible on the command line. For script use see the -i option.

形式

  • http://d.hatena.ne.jp/moroto1122/20110927/1317101449
    $ htpasswd -c .htpasswd user1	// default(CRYPT)
    $ htpasswd -m .htpasswd user2	// MD5
    $ htpasswd -s .htpasswd user3	// SHA
    $ htpasswd -p .htpasswd user4	// no password
    
    $ cat .htpasswd
    user1:kFTZnBZFbadEc
    user2:$apr1$O.Vw....$k/hgC.7.ANbuNp4N4QHs4.
    user3:{SHA}cRDtpNCeBiql5KOQsKVyrA0sAiA=
    user4:1234
  • cryptApache 2.2.17まで。Apache 2.2.18?からはMD5がデフォルト。

CentOS/パッケージ