是否可以启用sudo -u仅适用于特定用户?

我想弄明白这一点,但还没有find一个适当的答案呢:

是否有可能添加一个用户到/etc/sudoers 只有权限使用sudo -u特定的用户

是的,您可以指定sudoers文件中的用户

让用户以specificuser用户身份运行任何命令:

  youruser ALL =(特定用户)ALL 

man sudoers页面:

Runas_Spec为后面的命令设置默认值。 这意味着对于条目:

  dgb boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm 

用户dgb可以运行/ bin / ls,/ bin / kill和/ usr / bin / lprm – 但只能作为运算符。 例如,

  $ sudo -u operator /bin/ls. 

我正在运行sudo-1.7.4p5-4.fc15.x86_64