Ubuntu16系统中安装htpasswd

htpasswd生成包含用户名和密码的文本文件,

每行内容格式为“用户名:密码”,

用于用户文件的基本身份认证。
当用户浏览某些网页的时候,

浏览器会提示输入用户名和密码,

比如awstats的日志报表,

你肯定不希望别人也能访问,

因此就需要对这些报表网页的访问增加身份验证。

如果你的web服务器是apache的话,

那么应该会自带htpasswd程序的,

不过我用的是nginx,

所以就需要安装一下了

ubuntu的好处体现出来了,

输入htpasswd,

系统会提示在哪个包中可以找到,

共查到5个包,

不是每个包都有htpasswd,

parallels@parallels-vm:~$ sudo apt search htpasswd
Sorting... Done
Full Text Search... Done
apache2-utils/xenial-updates 2.4.18-2ubuntu3.9 amd64
  Apache HTTP Server (utility programs for web servers)

golang-github-abbot-go-http-auth-dev/xenial,xenial 0.0~git20150714.0.46b9627-1 all
  Basic and Digest HTTP Authentication for golang http

libapache-htpasswd-perl/xenial,xenial 1.8-1.1 all
  Manage Unix crypt-style password file

libauthen-htpasswd-perl/xenial,xenial 0.171-1 all
  Perl module to read and modify Apache .htpasswd files

libcatalyst-authentication-store-htpasswd-perl/xenial,xenial 1.003-1 all
  Authen::Htpasswd based user storage/authentication

lighttpd/xenial,now 1.4.35-4ubuntu2 amd64 [residual-config]
  fast webserver with minimal memory footprint

我们这里选apache2-utils。

parallels@parallels-vm:~$ sudo apt install apache2-utils

安装完查询确认有没有包含

parallels@parallels-vm:~$ which htpasswd
/usr/bin/htpasswd

 

 

posted @ 2018-12-17 17:10  乘于时  阅读(2958)  评论(0编辑  收藏  举报