RE: sudo in script -- automate with password

  • From: "Reidy, Ron" <Ron.Reidy@xxxxxxxxxxxxxxxxxx>
  • To: <cemail_219@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 4 Jan 2006 14:16:21 -0700

Programs such as sudo, passwd, etc. that prompt for a password (not
sqlplus) do not take those passwords from the command line.  This means
that you cannot use a here-document for these types of activities.
Instead, you will need to control the tty device.  The only way I know
to do this is to use the expect utility or the Perl Expect module.

However, this will mean you will need to hard-code the password into
your shell script.  If this is something you do not want or cannot do,
then you will have to create an entry in the sudoers file to allow the
command to be executed without a password.

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of J. Dex
Sent: Wednesday, January 04, 2006 2:04 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: sudo in script -- automate with password


I have got a database script that mid-way through the script it needs to
log 
in as sudo and run a process.  The problem is the sudo password.  I
can't 
figure out a way to put it in the script instead of manually having to
enter 
it.  Pulling the password from a password file doesn't seem to work
either.  
Has anyone else found a solution to this or needed to do this?   The OS
is 
AIX and it is Oracle 9202.  Is there a special syntax that needs to be
used?

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

--
//www.freelists.org/webpage/oracle-l



This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is 
intended 
to be for the use of the individual or entity named above. If you are not the 
intended recipient, please be aware that any disclosure, copying, distribution 
or use of the contents of this information is prohibited. Please notify the
sender  of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

--
//www.freelists.org/webpage/oracle-l


Other related posts: