Encrypt and Decrypt

I have script for all oracle prod db. I have hard coded the username / password. I need a mechanism to encode and decode the username / password in a shell script.

Another challenge is I use the username and password in a Select command for oracle DB. How can call the decrypted username/password inside a sqlquery command? Will this work ?

Thanks
Gopalan V

Anyhting you do in a shell script can easily be hacked (ie adding set -x)
at top of the script, editing the script to echo password to screen.... Therefore it defeats the purpose of crypting and decrypting the passwords in a script.

If you want to hide the password from a ps -ef command you can
do something like this:

#!/bin/ksh
sqlplus -s /nolog <<EOT
connect login/password
select name from v\$database;
exit;
EOT

The best way to proceed would probably be using your DB user (most
likely "oracle") and identify that that user externally so no
password is required to login to the DB

Hope this helps..
Good luck

By keeping your passwords in a recoverable form in the script, and including code to recover them in your script, you're giving would-be crackers step-by-step instructions to obtain your password.

chmod 600 is better security than this.