Solved: To impersonate any other user, I would have to specify the allowed commands:
e.g dummy ALL=(ALL:ALL) /usr/bin/whoami
This way, the dummy user would be able to execute that command for any other user.
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...