如何修复 htpasswd cannot open file htpasswd for read/write access
问题:
你正在尝试使用类似这样的命令在 htpasswd 文件中添加/更改密码
example-4.sh
但你看到此错误消息:
example-3.txt
解决方案
htpasswd 试图告诉你它在访问 htpasswd 文件时遇到 Permission denied,因此无法读取或写入文件(在此示例中为 auth.htpasswd)。
有多种方法可以修复此问题:
- 使用
sudo运行htpasswd,例如
example-2.sh
- 修复文件的权限,例如使用
example-1.sh
chmod o+rw auth.htpasswd注意这会永久修改 htpasswd 文件的权限,因此可能会产生额外的安全风险!
3. 使用你有权访问的其他 htpasswd 文件。你需要更改 Web 服务器等的配置(即使用 htpasswd 文件的软件)。此选项并不总是可用 - 例如,如果你无法更改 Web 服务器的配置,你只能选择友好地请求系统管理员。
Check out similar posts by category:
Allgemein
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow