Hello,
I have the following UNIX shell script which connects to the teradata database and executes the SQL Queries. For this, I am passing database name, username and password. I don't want to reveal my password to anyone. So, is there any way that I can encrypt my password and read the password while executing the script. How can I achieve this?
#!/bin/sh
a="temp.btq"
> $a
echo ".LOGON DEV/p2123,password">>$a
Any help is really appreciated. Thanks in advance.
To the best of my knowledge there is no robust way to encrypt/decrypt password in shell scripts. However you can try the below 4 approaches.
- keep the username/password in a config file in some safe place and change the permission of that file and extract the credentials to use in your script.
- Pass the username,password,DB name as command line arguments. $1 $2 $3
- install the crypt package
4 The best method is to find the equivalent of " Oracle wallet manager" for Teradata which will keep the credentials secret forever.
Thanks for the reply.
Can you please help me out with the 1st approach.