I would like to add a list of commands for a admin user to sudo into by editing the /etc/sudoers file using Cmnd_Alias.
The below is working :
1.Cmnd_Alias CMD_LIST = /user/local/bin/srm, /bin/rm
2.admin ALL = NOPASSWD: CMD_LIST
But I have a list of nearly 20 commands to be added and specifying them by delimiting them by commas in line 1 seems clumsy .
For a cleaner script, I want to give a script (that echo's these commands ) as an input to the CMD_LIST like below but it's NOT working.
Cmnd_Alias CMD_LIST = $(/etc/sudo_command_list.sh)
admin ALL = NOPASSWD: CMD_LIST
The contents of the script is as below:
cat /etc/sudo_command_list.sh
echo "/user/local/bin/srm, /bin/rm"
I tried giving this list using a shell script as well as a file input, but cmnd_Alias didn't seem to take it