VSPTv

Wednesday 14 September 2022

How to encrypt and decrypt a password in UNIX shell script?

Unix Shell Script
[srv049 ~]$ cd /informatica
[srv049 informatica]$ echo  'YourPassw0rd@123#' | base64 > passcodefile.crdn
[srv049 informatica]$ echo $(echo Your encryted passwrod is : ) $(head -1 passcodefile.crdn)
Your encryted passwrod is : WW91clBhc3N3MHJkQDEyMyMK
[srv049 informatica]$ cd /informatica
[srv049 informatica]$ PASSWORD_VARIABLE=$(echo $(head -1 passcodefile.crdn) | base64 --decode)
[srv049 informatica]$ echo '                         'Original password : $PASSWORD_VARIABLE
                         Original password : YourPassw0rd@123#
[srv049 informatica]$