Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you run .profile during execution of sudo?

Status
Not open for further replies.

buellwinkle

Programmer
Jul 18, 2003
5
US
I'm trying to use sudo for DBAs to log into the oracle account for SOX reasons. It works where they can do "sudo -u oracle ksh" and their uid is now oracle but they are still in their own home directory, not oracle and it didn't run the .profile so they have to do a cd /home/oracle and then . ./.profile. So what I would like is to be able to do the same thing as su - oracle but do it with sudo. Also, is the logging done by sudo better than what's in the sulog?
 
Maybe set it so your DBAs can do an "[tt]su - oracle[/tt]" via sudo. Config file like this might do it...
Code:
# User alias specification
User_Alias      DBAS=someuser,another,buellwinkle

# Cmnd alias specification
Cmnd_Alias      DBACMD=/usr/bin/su - oracle

# User privilege specification
root            ALL=(ALL) ALL

DBAS            ALL=(root) NOPASSWD: DBACMD
This will let a select list become the user [tt]oracle[/tt]. To become [tt]oracle[/tt], they just type...
Code:
sudo su - oracle
Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top