The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 11: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 03:21 PM
Where's the .profile environment config for root under Bourne shell? Joncamp SUN Solaris 2 12-02-2006 04:22 AM
how to access root priveliges if root password is lost wojtyla Linux 1 02-18-2005 06:24 AM
Lost root password / Can't login as root Perderabo Answers to Frequently Asked Questions 0 06-22-2004 07:40 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-02-2004
bubba112557 bubba112557 is offline
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
  #2 (permalink)  
Old 12-02-2004
bubba112557 bubba112557 is offline
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
  #3 (permalink)  
Old 12-03-2004
TioTony's Avatar
TioTony TioTony is offline Forum Advisor  
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0