How do I edit /etc/sudoers from a script?

后端 未结 12 815
花落未央
花落未央 2020-12-04 05:43

I need to edit /etc/sudoers from a script to add/remove stuff from white lists.

Assuming I have a command that would work on a normal file, how could I

12条回答
  •  感情败类
    2020-12-04 06:41

    Try to echo it. You have to run it in a subshell, though. Example:

    sudo sh -c "echo \"group ALL=(user) NOPASSWD: ALL\" >> /etc/sudoers"

提交回复
热议问题