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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章