Linux permissions: SUID, SGID, and sticky bit
- Allow member of group sudo to run below command
%sudo ALL=(ALL:ALL) /path/to/allowed/command1,/path/to/allowed/command2
- If you want to allow the user to run the allowed commands without entering a password, you can append NOPASSWD: before the command path
%sudo ALL=(ALL) NOPASSWD: /path/to/allowed/command
- disallow all commands, then allow only poweroff without asking password
# Allow guestx user to remote poweroff
guestx ALL=(ALL) !ALL
guestx ALL=NOPASSWD: /sbin/poweroff