The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can't login root account due to can't find root shell neikel AIX 2 01-30-2008 07:07 PM
I need it to prompt me for a root password, so I don't have to log as root lunchtime UNIX for Dummies Questions & Answers 2 06-25-2007 12:21 PM
Where's the .profile environment config for root under Bourne shell? Joncamp SUN Solaris 2 12-02-2006 12:22 AM
how to access root priveliges if root password is lost wojtyla Linux 1 02-18-2005 02:24 AM
Lost root password / Can't login as root Perderabo Answers to Frequently Asked Questions 0 06-22-2004 04:40 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2004
Registered User
 

Join Date: Apr 2004
Posts: 21
Run non-root script as root with non-root environment

All,

I want to run a non-root script as the root user with non-root environment variables with crontab. The non-root user would have environment variables for database access such as Oracle or Sybase. The root user does not have the Oracle or Sybase enviroment variables. I thought you could do with the sh command. I am not sure.

Thanks,

Mike
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-02-2004
Registered User
 

Join Date: Apr 2004
Posts: 21
All,


Could the solution be:

#/bin/su - oracle -c script.sh

I do not know why I got su confused with sh.

Mike
Reply With Quote
  #3 (permalink)  
Old 12-02-2004
TioTony's Avatar
Bit Pusher
 

Join Date: Oct 2001
Location: Southern California
Posts: 332
I think your su solution is still going to run it as oracle with oracle's environment. I believe what you need to do is this:

chown root script.sh
chmod u+s script.sh

Then just add the script to oracle's cron.

The u+s tells the OS to run the script as the root even if root is not the person calling it. Beware this could have some security implications. Read the man pages for chmod over and over until it makes sense.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0