我想使用 htpasswd 在Linux(Centos)中保护文件/文件夹密码。 我做了以下事情: -
root@ cd /mnt/Recordings/CONF (I have Changed the directory)
CONF@ htpasswd -c .htpasswd xxxxx
CONF@ pwd
/mnt/Recordings/CONF
CONF@ vim .htaccess
AuthUserFile /mnt/Recordings/CONF/ .htpasswd
AuthName "Enter Password"
AuthType Basic
AuthName "Protected Context"
<Limit GET POST>
require valid-user
Require python
</Limit>
我无法在Linux中创建受密码保护的文件/文件夹(“前端”/“命令提示符”/“基于Web”)。 我收到了以下错误:
[Wed Jan 08 17:38:57 2014] [alert] [client xxx.xxx.xxx.xxx] /mnt/Recordings/CONF/.htaccess:auth文件类型无效:.htpasswd
答案 0 :(得分:0)
尝试在htaccess文件中执行以下代码:
AuthUserFile "/mnt/Recordings/CONF/.htpasswd"
AuthType Basic
AuthName "My Secret Folder"
Require valid-user
Satisfy any
Order deny,allow
Deny from all