jump to navigation

How to hide the passwords in shell script December 1, 2015

Posted by sendtoshailesh in Uncategorized.
Tags: , ,
add a comment

How to hide the password in shell script say for example you want to hide the password from Oracle RMAN backup script. Then on Linux platform this can done using openssl command as follows:

 

Below script to be ready for one time use whenever you change the password.
read -s -p “Enter Password :- ” _PAS
echo “$_PAS”|openssl enc -base64 > encrypted_passwd

 
unix shell scripts where rman backup is coded should be added with following code. Most probably this will placed just before script connect to rman

syspwd=`cat encrypted_passwd|openssl enc -base64 -d`
rman target sys/${syspwd}@service