我试图允许一组用户获得对 dhcpcd 服务实例的一些控制。换句话说,我希望他们能够运行:
systemctl (start,stop,...) dhcpcd@eth0.service
Run Code Online (Sandbox Code Playgroud)
没有被提示输入密码,但只在 dhcpcd@eth0.service 上。我已经遇到过这样做的方法,但是它们需要在自己的行中枚举每个子命令。
%mygroup ALL=NOPASSWD: /usr/bin/systemctl start dhcpcd@eth0.service, /usr/bin/systemctl stop dhcpcd@eth0.service, ...
Run Code Online (Sandbox Code Playgroud)
有没有更优雅的方法来做到这一点?