I would like to run commands on an AIX system with sudo -i
instead of just sudo
. This way I can make sure that any environment settings like umask
will be those of the user I'm running the command as.
When the process started this way generates files, those files will obviously have their owner/group set to that of the user the process is run as.
Sudo has the option to specify the user (-u) and the group (-g). However, when I try to run a command using those parameters, I get the following error:
[johndoe@catchyname ~] # sudo -u 'foo' -g 'bar' ls
Sorry, user johndoe is not allowed to execute '/usr/bin/ls' as foo:bar on catchyname.
The user is allowed to run anything on this system in the /etc/sudoers
file.
I have looked through the sudo
documentation and searched the internet many a time, but haven't been able to get this to work yet.
What am I missing or doing wrong?
Best Answer
man sudoers
says:and further provides an example: