I was trying to limit the command a specific user can execute in the sudoers file, say I have something like this:
dummy myserver=(ALL:ALL) /usr/sbin/reboot,/usr/sbin/shutdown
My dummy user is only allowed to reboot or shut down the system. I intentionally allow the dummy user to impersonate other users, but anytime I try using the -u option of the sudo e.g sudo -u anotheruser whoami
I get the following error:
Sorry, user dummy is not allowed to execute '/usr/bin/whoami' as anotheruser on myserver.
I understand I can specifically call out the user and group I want to impersonate in the sudoers, but I am curious as to why the ALL:ALL doesn't work
I would greatly appreciate your answers.