I’m using AIX 5.3 with sudo 1.6.9p23. Sudoers file grants user fcomartin permission to run any command as user oas:
fcomarti ALL=(oas) ALL
User oas has a bash script called menu, from which it launches another scripts depending on the selected option. The problem is that some of the secondary scripts redirects standard output to text file “temp” which is owned by oas user, when this happens the system tells me that user do not have the right permissions to write.
User fcomarti uses ksh, then the used command is as follows:
sudo -u oas bash menu
(bash because user oas uses bash) Menu starts, menu launches monitorAv script, inside monitorAv is the line echo > temp, it then tells user fcomarti it do not have the right permissions to write.
I’ve finally solved the problem, the sintaxis of sudo is as follows:
This is because some of the secondary scripts launched by menu, needs an absolute route to work.