Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: sudo in script -- automate with password

RE: sudo in script -- automate with password

From: Reidy, Ron <>
Date: 2006-01-04 22:16:21

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-----

[] On Behalf Of J. Dex Sent: Wednesday, January 04, 2006 2:04 PM To:
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!


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.

-- Received on Wed Jan 04 2006 - 22:16:21 CST

Original text of this message