0

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, which launches other scripts depending on the selected option.

The problem is that some of the secondary scripts redirect standard output to text file temp which is owned by oas user. When this happens the system tells me that user does not have the right permissions to write.

User fcomarti uses ksh, the used command is as follows:

sudo -u oas bash menu

(bash because user oas uses bash).

Menu starts and then menu launches monitorAv script. Inside monitorAv is the line echo > temp; it then errors saying user fcomarti does not have the right permissions to write.

How can I resolve this?

0

Edit that script, don't run sudo something > here, use it like this sudo sh -c "something > here"

man can be quiet useful, search for redirection in man sudo.

  • Thanks for the answer, i can't edit the scripts owned by user oas, the problem as i see it is that the secondary scripts launched by menu wont inherit the right permissions. – carlos.mejia Nov 14 '12 at 18:49
  • Did you try sudo -u oas bash -c "menu"? – week Nov 14 '12 at 19:03
  • Yes i have used that syntaxis, it keeps telling me: temp: The file access permissions do not allow the specified action. – carlos.mejia Nov 14 '12 at 19:08
  • You may try to use groups and whoami before that echo. To find out what user execs it. Which permissions are on the file temp. – week Nov 14 '12 at 19:15
-1

I've finally solved the problem, the sintaxis of sudo is as follows:

sudo -u oas bash -c "cd /Oas/bin; menu"

This is because some of the secondary scripts launched by menu, needs an absolute route to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.