LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2008, 07:06 PM   #1
lunlun
Member
 
Registered: Jul 2005
Posts: 41

Rep: Reputation: 15
bash shell script "sudo -


Hi there I got a question about the bash shell script and sudo.

Normally I would google for help, but then I dont know what am i supposed to search for.

e.g. i am under root user
Code:
sudo -u oracle sqlplus user/pass <createuser.sql

sudo -u oracle sqlplus user/pass <dosomething.sql

mkdir ./temp

my understanding is the sudo -u user let us execute a command on a specific user.

For my above scenario,

is there a way to modify my bash file so that upon the oracle user finishing its "sqlplus user/pass <createuser.sql" statement,

my bash file will continue to execute?


Thanks!
 
Old 05-09-2008, 07:17 PM   #2
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: My HDD...
Distribution: WinXP for designing, Linux for life.
Posts: 2,329
Blog Entries: 1

Rep: Reputation: 47
I'm assuming you aren't using some type of Ubuntu...

If you are running a shell script as the root user you will not need to put "sudo" in the script. Ubuntu disables the root account by default, restricting major changes to the local user's password.

The command "su" will prompt for the root password, and will allow you to do *most things. The command "su -" will actually switch you to the root account. And, assuming you have more than one user account, the command "su - whateverusername" will "log you in" (in the given shell) as that user.
 
Old 05-09-2008, 09:42 PM   #3
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey there,

Also make sure that (even though it's not necessary in certain circumstances) you make the sudo rule NOPASSWD: so that if, say, the oracle user has it in their .profile, it won't hang waiting on an interactive password entry!

Best wishes,

Mike
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Shell script sudo without password prompt under Darwin? lhouk Other *NIX 3 02-08-2008 11:16 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
ubuntu - running sudo shell script from php mitilma Linux - Security 3 06-14-2007 01:52 AM
allow sudo for www user to run root shell script cccc *BSD 12 07-23-2005 03:48 PM


All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration