Ubuntu 系统中安装htpasswd

htpasswd是Apache附带的程序,

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

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

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

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

比如awstats的日志报表,

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

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

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

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

不过我用的是nginx,

所以就需要安装一下了

ubuntu的好处体现出来了,

输入htpasswd,

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

共查到5个包,

不是每个包都有htpasswd,

apt search htpasswd

Sorting... Done
Full Text Search... Done
apache2-utils/oldoldstable 2.4.10-10+deb8u16 amd64
  Apache HTTP Server (utility programs for web servers)

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

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

lighttpd/oldoldstable,oldoldstable 1.4.35-4+deb8u1 amd64
  fast webserver with minimal memory footprint
apt install apache2-utils

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libapr1 libaprutil1
The following NEW packages will be installed:
  apache2-utils libapr1 libaprutil1
0 upgraded, 3 newly installed, 0 to remove and 291 not upgraded.
Need to get 196 kB/378 kB of archives.
After this operation, 959 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.cloud.aliyuncs.com/debian-security/ jessie/updates/main apache2-utils amd64 2.4.10-10+deb8u16 [196 kB]
Fetched 196 kB in 0s (2,329 kB/s)
Selecting previously unselected package libapr1:amd64.
(Reading database ... 47423 files and directories currently installed.)
Preparing to unpack .../libapr1_1.5.1-3_amd64.deb ...
Unpacking libapr1:amd64 (1.5.1-3) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../libaprutil1_1.5.4-1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-1) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.10-10+deb8u16_amd64.deb ...
Unpacking apache2-utils (2.4.10-10+deb8u16) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libapr1:amd64 (1.5.1-3) ...
Setting up libaprutil1:amd64 (1.5.4-1) ...
Setting up apache2-utils (2.4.10-10+deb8u16) ...
Processing triggers for libc-bin (2.19-18+deb8u6) ...
htpasswd -bc .users user passwd

 

 

 

 

发布了138 篇原创文章 · 获赞 93 · 访问量 23万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章