我在Debian 10 (Buster)和Apache2.4.38上运行web服务器。我创建了一个特殊的用户acme,它运行用于更新TLS证书的脚本。
$ cat /etc/passwd | grep ^acme
acme:x:1002:1002::/var/acme:/usr/bin/nologin
$ cat /etc/group | grep ^acme
acme:x:1002:应该允许此acme用户在证书更新后重新加载Apache2配置。因此,我使用/etc/sudoers将这一行添加到visudo(8)中:
%acme ALL=(root) NOPASSWD: /etc/init.d/apache2 reload不幸的是,这是行不通的:
$ sudo -u acme /etc/init.d/apache2 reload
[....] Reloading apache2 configuration (via systemctl): apache2.serviceFailed to reload apache2.service: Access denied
See system logs and 'systemctl status apache2.service' for details.
failed!我错过了什么吗?
发布于 2021-07-28 18:49:32
在运行sudo时,您需要成为的用户顶点,而不是使用-u acme。
acme@host:~ $ sudo /etc/init.d/apache2 reload另一个可能的问题是:
sudoers文件中的%表示acme是一个组。当您的用户在一个名为acme的组中时,这不是一个问题,但如果他不是。
https://serverfault.com/questions/1070932
复制相似问题