You are probably wondering how the sudoers file works. Here’s a simple explanation.


<pre lang="bash">username host=(user:group) tag:commands


    • username – the specified user allowed to run commands.
      • host – the specified host the command is allowed to run.
      • user – specifies which users can use the command.
      • group – specifies which groups can run the command.
      • tag – the option allowed. NOPASSWD
      • command – the command allowed to run.


<pre lang="bash">root    ALL=(ALL) ALL
username ALL=(ALL) ALL
john test=(ALL) NOPASSWD: /bin/useradd
jane ALL=(sales) NOPASSWD: /bin/sh
%sudo ALL=(ALL) ALL
%adgroup ALL=(ALL) ALL