This assumes you are familiar with the /etc/sudoers file.
Use the visudo command to edit the /etc/sudoers file. The syntax of lines in the /etc/sudoers file is users hosts=(user:group) commands. In this example, members of the admins group are given permission to issue the ifup and ifdown commands using sudo.
%admins ALL=(ALL:ALL) /sbin/ifup, /sbin/ifdown
The NOPASSWD option can be included to ensure that the sudo command does not prompt the user for their password.
%admins ALL=(ALL:ALL) NOPASSWD: /sbin/ifup, /sbin/ifdown
There may be a line that gives members of the sudo group or wheel group permission to run all commands on all hosts. You probably do not want to comment out this line.
%sudo ALL=(ALL:ALL) ALL
%wheel ALL=(ALL:ALL) ALL
Or, there may be a line that gives members of the sudo group or wheel group permission to run all commands on all hosts with no password. If this line is not commented out, you probably do not want to comment out this line.
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
Did you find this article helpful?
If so, consider buying me a coffee over at