How to edit /etc/sudoers so that I can run another users script
Hi,
I'm a newbie so please help, and if this is the wrong forum guide me to the correct one thanks. I want to run a script owned by another user. It should not be run by root. I have edited the sudoers file but it runs the script as root, I want it to run it as user grid? This is what I have so far : udo -l User oracle may run the following commands on this host: (root) /home/grid/asm_test.sh cat /etc/sudoers # User_Alias ADMINS = jsmith, mikem User_Alias MAINTAINERS = oracle ## Command Aliases ## These are groups of related commands... Cmnd_Alias DEB = /home/grid/asm_test.sh ## Allow root to run any commands anywhere root ALL=(ALL) ALL MAINTAINERS ALL=DEB Please help, I'm stuck |
What about:
Code:
su - grid -c $command |
To run a script as another user with sudo you have to use the -u option, for example
Code:
sudo -u user2 myscript Code:
man sudo |
Hi,
Welcome to the forum...as far as I'm concerned, this is the right place, dont worry. ;) Okay, SUDO means that if you do this Quote:
Quote:
What I can suggest is two things: - place the script in a system-wide accessible spot (/opt/somefolder for example) and set the rights to the corect group, you and the "other user" belong to a group, well then. Make sure you're both in the same user group... - copy the script to your own space, very quick, but very-very dirty...not the cleanest plan... Good luck with this! Thor |
Thanks for the fast responses!
jamescondron : su - grid -c /home/grid/asm_test.sh , still asks for a password, I need to run it so it doesn't ask for a password TobiSGD : I tried that but complains that the user is not in the sudoers file - sudo -u grid /home/grid/asm_test.sh Sorry, user oracle is not allowed to execute '/home/grid/asm_test.sh' as grid on avgo2db01.theavenggroup.com. Thor_2.0 : I created a scripts directory /opt/scripts, moved the script but gives me the same permissions error: /u01/app/grid/product/11.2.0/grid/bin/asmcmd: line 122: /u01/app/grid/product/11.2.0/grid/perl/bin/perl: Permission denied Both users belong to the same group. |
Deleted: Have read the previous post wrong. Sorry.
|
Quote:
Thor |
All times are GMT -5. The time now is 12:18 PM. |