1752808 Members
6101 Online
108789 Solutions
New Discussion юеВ

Re: Sudo Question

 
SOLVED
Go to solution
Waqar Razi
Regular Advisor

Sudo Question

I have been asked to give access to one user to bring up and shutdown the application. I have used sudo before to give some one root access to perform some tasks that need root priveleges. To start and stop this particular application, you need to ORACLE and not ROOT.

Can some one advice if we can implement this using sudo, i-e, grant some one priveleges of the oracle user to start and stop the application scripts.
7 REPLIES 7
Tim Nelson
Honored Contributor

Re: Sudo Question

how about something like this..

Cmnd_Alias APP = /apps/scripts/app_control.ksh

oracle server1=(appuser1,appuser2) NOPASSWD:APP


Waqar Razi
Regular Advisor

Re: Sudo Question

Can u please explain it in more detail?

Is that possible to grant some one to launch the startup and shutdown scripts as oracle (just these scripts launching as oracle and not any other thing as oracle) using sudo.

If you can provide more details and steps, I would really appreciate it.
Tim Nelson
Honored Contributor

Re: Sudo Question

edit /etc/sudoers with visudo

you can create a command alias with a list of commands that can be executed.

Cmnd_Alias APP_SHUTDOWN = /path/to/script1, /path/to/script2

then

give oracle permission to execute it as the application user appuser1


oracle localhost=(appuser1) NOPASSWD:APP_SHUTDOWN

or skip the cmnd_alias

oracle localhost=(appuser1) NOPASSWD:/path/to/script


then logged in as oracle
sudo -u appuser1 /path/to/script
Waqar Razi
Regular Advisor

Re: Sudo Question

Let me make it more clear:

The user name is user1.

The user logs in to the system as user1.

Can he run some scripts as oracle user using sudo. The script needs to be run as oracle and not as root.
Tim Nelson
Honored Contributor
Solution

Re: Sudo Question

how about this way then...

user1 localhost=(oracle) NOPASSWD:/path/to/script


Patrick Wallek
Honored Contributor

Re: Sudo Question

The user would then run the script as:

$ sudo -u oracle /path/to/script
bullz
Super Advisor

Re: Sudo Question

Hope u have already got enough replies.

Just FYI..

sudo su - oracle
#Login as oracle and do whatever you want :)