1 安装squid

sudo apt-get install squid

2 安装 htpasswd (如果装了apache就省掉这一步)

(这个是用来产生密码的)

 sudo apt-get install apache2-utils

也可以

sudo apt-get install  mini-httpd

 3  生成密码文件

 htpasswd -c /etc/squid/passwd user1

会让你输入user1的密码

 4  改一下权限,确保squid能够读出密码文件

sudo chmod o+r /etc/squid/passwd

5  修改squid.conf,增加或修改成下面的样子

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

 

acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
 

 6 重启squid

sudo /etc/init.d/squid restart

 搞定!

 如果你手上没有htpasswd,又不想装htpasswd。那也可以从别的机器上cp过来一份密码文件。

相关文章:

  • 2021-07-25
  • 2021-11-28
  • 2021-11-28
  • 2022-12-23
  • 2022-01-07
  • 2021-12-25
  • 2021-12-09
  • 2021-09-02
猜你喜欢
  • 2022-12-23
  • 2021-12-19
  • 2021-08-07
  • 2021-12-10
  • 2021-08-25
  • 2021-09-15
  • 2021-11-26
相关资源
相似解决方案