Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment variables

Status
Not open for further replies.

KarthikBabu

Programmer
Jul 17, 2001
18
IN
Is there anyway by which i can prevent the value of an environmental variable from being displayed while using the echo statement.

I have an environmental variable SQLPASSWORD that i am setting up in my .profile. I do not want the value of this variable to be displayed while using the echo statement. The command
echo $SQLPASSWORD
should return nothing. But i should be able to login in to the database using $SQLPASSWORD. In other words, i should be able to use the environment variable but not display its value thru echo statement. Is this possible? Thanks.
 
Don't think so.

Surely if the var is set in your .profile, no-one else but you will be able to see the value!

I suppose if you do an echo on the var in your session someone in theory could pick up the value. Is that your concern?

On our system, we store the password in a file .sqlpw in the home dir of the user logging in to the DB. The perms on that file are set to 400. When we log onto the DB, we do feed in the file contents at the appropriate moment.

Probably not foolproof, but it works OK.

Greg.
 
Thanks Greg. That is an wonderful idea. Today we have implemented security using the .sqlpw file and feeding the contents at the appropriate time. But some developers have broken the security by copying the logic that is built to read the contents of the .sqlpw file. (We use a C executable to get the password of a sql user from .sqlpw). So i was wondering if we can set up environmental variables and hide the value by turning on some flag or something like that. Looks like it is not possible.

Thanks for your valuable input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top