1.修改Apache的配置文件/usr/local/apache/conf/httpd.conf,对认证资源所在的目录设定配置命令。下例是对/usr/local/apache/htdocs/ntop目录的配置:
<Directory /usr/local/apache/htdocs/ntop>
Options Indexes FollowSymLinks allowoverride authconfig #表示允许对/usr/local/apache/htdocs/ntop目录下的文件进行用户认证# order allow,deny allow from all </Directory> |
2.在限制访问的目录/usr/local/apache/htdocs/ntop下建立一个文件.htaccess,其内容如下:
AuthName ""
AuthType basic AuthUserFile/usr/local/apache/ntop.txt require ntop #ntop用户可以访问# |
3.利用Apache附带的程序htpasswd,生成包含用户名和密码的文本文件:/usr/local/apache/ntop.txt,每行内容格式为“用户名:密码”。
#cd /usr/local/apache/bin
#htpasswd -bc ../ntop.txt user1 234xyx14 |
--user ntop
### Sets the directory that ntop runs from.
--db-file-path /var/ntop
### Interface(s) that ntop will capture on (default: eth0)
#--interface eth0
### Configures ntop not to trust MAC addrs. This is used when port mirroring or SPAN
#--no-mac
### Logging messages to syslog (instead of the console):
### NOTE: To log to a specific facility, use --use-syslog=local3
### NOTE: The = is REQUIRED and no spaces are permitted.
--use-syslog
### Tells ntop to track only local hosts as specified by the --local-subnets option
#--track-local-hosts
### Sets the port that the HTTP webserver listens on
### NOTE: --http-server 3000 is the default
#--http-server 3000
###表示使用https连接#
--https-server 3001 ### Sets the networks that ntop should consider as local.
### NOTE: Uses dotted decimal and CIDR notation. Example: 192.168.0.0/24
### The addresses of the interfaces are always local and don't need to be specified.
#--local-subnets xx.xx.xx.xx/yy
### Sets the domain. ntop should be able to determine this automatically.
#--domain mydomain.com
### Sets program to run as a daemon
### NOTE: For more than casual use, you probably want this.
#--daemon
|