使用非root用户重新启动服务

时间:2014-12-16 05:48:35

标签: linux apache web-services service ubuntu-14.04

我正在使用UBUNTU-14.04 LTS

我想用非root用户重启服务。

我对Apache服务的visudo文件进行了更改,

用户权限规范

root ALL =(ALL:ALL)ALL

用户名ALL = / etc / init.d / apache2

用户名ALL = NOPASSWD:/etc/init.d/apache2 restart

但它不能正常工作

输出

Restart with **non-root user**

/etc/init.d/apache2 restart
 * Restarting web server apache2      [fail]

Restart with **root user**

/etc/init.d/apache2 restart
 * Restarting web server apache2      [ OK ]

等待积极回应。

任何形式的帮助都将受到赞赏。

由于

1 个答案:

答案 0 :(得分:0)

您是否尝试将用户置于一个群组中并授予他所有文件的权利?

这应该将(现有的)userA添加到groupA并授予他对directoryA

的权限
sudo usermod -a -G groupA userA

sudo chown -R userA:groupA directoryA

希望这有帮助