SUDO help RHEL 5*
Hi All,
Please read th below scenario 1) two users abc and xyz. 2) user abc have sudo permission to access xyz's account without password. 3) now user abc need to run a script resides in his home directory. script may be like this #!/bin/bash sudo su - xyz ls -ltr just to show the files in the xyz's home directory. is it possible to do so? if yes, then how. Thanks in advance. |
Hi
Try sudo /bin/sh -c "cd /home/xyz; ls -ltr" Nitin |
this looks a hell of a lot like homework, but ok...
DON'T DO "sudo su -" IT IS AN EVIL HACK THAT IS NOT NEEDED ANYMORE. NEVER DO IT. Do "sudo -i" instead. Just run "sudo -i -u xyz ls -ltr" |
Thanks for your inputs.
Hi Moderator this is not a homework.;) sadely this didn't solve my purpose. As i clearly mentioned above that this all should be in a shell script(point 3) (i just gave a example there) and i need to run this script from user abc to extract information (file etc.) that resides in user xyz home directory.(i exactly didn't want ll -tr result that was just for the example). conditions only sudo access is allow to user xyz. |
Quote:
|
Quote:
|
Quote:
|
All times are GMT -5. The time now is 06:59 PM. |