axy/htpasswd-cli

Htpasswd CLI 工具

0.1.1 2015-12-03 11:12 UTC

This package is auto-updated.

Last update: 2024-09-08 02:00:33 UTC


README

俄语文档.

PHP 5.4+

库不依赖任何其他依赖(除了composer包)。

提供控制台工具 axy-htpasswd,与Apache htpasswd 工具类似。

安装(通过composer)

$ composer global require axy/htpasswd-cli

工具存储在目录 .composer/vendor/bin 中。如果此目录已添加到 $PATH,您可以从命令行使用此工具。

$ axy-htpasswd -cb .password-file nick password

您可以将 axy-htpasswd 重命名为 htpasswd 并按常规使用。

算法

axy-password 支持Apache 2.4 htpasswd的所有加密算法。

  • BCrypt
  • MD5(Apache 版本)
  • SHA1
  • CRYPT
  • 明文

接口

axy-passwordhtpasswd 的接口匹配。

Usage:
	axy-htpasswd [-cimBdpsDv] [-C cost] passwordfile username
	axy-htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password

	axy-htpasswd -n[imBdps] [-C cost] username
	axy-htpasswd -nb[mBdps] [-C cost] username password
 -c  Create a new file. (no effect in the current version)
 -n  Don't update file; display results on stdout.
 -b  Use the password from the command line rather than prompting for it.
 -i  Read password from stdin without verification (for script usage).
 -m  Force MD5 encryption of the password (default).
 -B  Force bcrypt encryption of the password (very secure).
 -C  Set the computing time used for the bcrypt algorithm
     (higher is more secure but slower, default: 5, valid: 4 to 31).
 -d  Force CRYPT encryption of the password (8 chars max, insecure).
 -s  Force SHA encryption of the password (insecure).
 -p  Do not encrypt the password (plaintext, insecure).
 -D  Delete the specified user.
 -v  Verify password for the specified user.
On other systems than Windows and NetWare the '-p' flag will probably not work.
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.

差异

  • 选项 -c 无效。如果文件存在,则会更改;如果不存在,则会创建。
  • 许多选项组合的错误会被忽略。
  • 选项 -n 可以与 -D-v 一起使用。它相当于空文件,用户将找不到。

程序API

有关程序API(PHP)的信息,请参阅 axypro/htpasswd