首页 > 解决方案 > 试图让用户看到letsencrypt密钥

问题描述

我不知道这是否是正确的地方,但我会试一试

我试图让用户mysql读取letsencrypt密钥。
通常任何用户都可以看到livearchive文件夹,因此 mysql 用户也可以

debian:~# sudo -u mysql ls /etc/letsencrypt/archive/
example1.com example2.com example3.com

如果我尝试查看其中的文件

debian:~# sudo -u mysql ls /etc/letsencrypt/archive/example1.com
ls: Zugriff auf /etc/letsencrypt/archive/example1.com/ nicht möglich: Keine Berechtigung

(德语是什么意思:你无权查看文件。)
然后我装了setfacl并试图获得对文件的 mysql 访问权限,所以我去了:

setfacl -R -m "u:mysql:r" /etc/letsencrypt/archive/

然后我检查了acl

debian:~# getfacl /etc/letsencrypt/archive/example1.com
getfacl: Entferne führende '/' von absoluten Pfadnamen
# file: etc/letsencrypt/archive/example1.com
# owner: root
# group: root
user::rwx
user:mysql:r--
group::r-x
mask::r-x
other::r-x

然后我变得自信并称赞自己,就像我做聪明事时经常做的那样。
出于某种原因,我再次检查:

debian:~# sudo -u mysql ls /etc/letsencrypt/archive/example1.com
ls: Zugriff auf /etc/letsencrypt/archive/example1.com/ nicht möglich: Keine Berechtigung

用户 mysql 仍然什么也看不到。(setfacl --version 2.2.52)我错过了什么吗?

标签: bashacl

解决方案


您还需要在文件夹上设置可执行位(x),以便用户能够实际导航到目录中。尝试以下操作:

setfacl -m "u:mysql:rx" /etc/letsencrypt/archive/
setfacl -R -m "u:mysql:r" /etc/letsencrypt/archive/*

推荐阅读