RE: unix Ksh script variable

  • From: "Bellows, Bambi (Comsys)" <bbel5@xxxxxxxxxxxx>
  • To: <Jed_Walker@xxxxxxxxxxxxxxxxx>, "Martijn Bos" <maboc@xxxxxxxx>
  • Date: Mon, 31 Jan 2011 12:11:35 -0600

There are a bunch of ways to do it; but, assuming that you don't have an
algorithm for passwords, the easiest and most secure manner that I know
of is to store the passwords in a dotfile and set the privilege level to
400; then you don't need to worry about prying eyes seeing your password
file and you can change passwords at will.  I tend to avoid $1 $2 etc as
they can get forgotten or screwed up.  If you are passing parameters on
the command line, use getopts.

HTH,
Bambi.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Walker, Jed S
Sent: Monday, January 31, 2011 10:32 AM
To: Martijn Bos
Cc: A Joshi; oracle-l@xxxxxxxxxxxxx
Subject: RE: unix Ksh script variable

There are ways to store your password, once you get the username then
make a call to your password storage engine for the password.

We have numerous scripts that can take a username as specified and
retrieve the password.

-----Original Message-----
From: Martijn Bos [mailto:maboc@xxxxxxxx] 
Sent: Monday, January 31, 2011 8:44 AM
To: Walker, Jed S
Cc: A Joshi; oracle-l@xxxxxxxxxxxxx
Subject: Re: unix Ksh script variable

Hi,

On Mon, Jan 31, 2011 at 02:36:28PM +0000, Walker, Jed S wrote:
> Why not just pass in the username as the parameter
> 
> Script  sys
> 
> $1 is then sys (or whatever username you want to pass in)
> 

But then still you need somewhere to store passwords and sid to use when
connecting.
(ahum....assumption is the mother of all.......
(but I assumed a central system" of which the script is run. It then has
to connect to various databases.
(Then you somewhere have to have the credentials and/or
connectinformation 
(but then again ....assumption is the mother.....

Best Regards,
Martijn


> -----Original Message-----
> From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Martijn Bos
> Sent: Monday, January 31, 2011 5:04 AM
> To: A Joshi
> Cc: oracle-l@xxxxxxxxxxxxx
> Subject: Re: unix Ksh script variable
> 
> Hi,
> 
> My idea for your question
> Can't you use:
> echo $usr
> 
> 
> My idea for a sligthly different approach:
> 
> I would not define all the variables in the script itself.
> If it was up to me I would create a "config-file" which looks like:
> <sid1>:<user-to-login-with1>:<password-for-this-user1>
> <sid2>:<user-to-login-with2>:<password-for-this-user2>
> ...
> ...
> ...
> 
> Then in your script loop through the config-file. With awk you can get
alle the variables you need for connecting
> 
> Best Regards,
> Martijn Bos
> 
> 
> 
> 
> On Sun, Jan 30, 2011 at 07:55:04PM -0800, A Joshi wrote:
> > hi
> > I have a script which is to be executed on many databases and
different databases have different log in users/password. Login needs to
be chosen based on parameter passed so if the parameter passed is 1 it
needs to choose user1 and so on. I will be doing sqlplus $usr@$DB and
need usr to have the value sys in this case and so on 
> > it is something like - 
> > user1=sys 
> > user2=system 
> > user3=emp 
> > pw1=x 
> > pw2=xx 
> > pw3=xxx 
> > #number=$1 
> > number=1 
> > us=user 
> > usr=$us$number 
> > export user1 user2 user3 number us usr 
> > export pw1 pw2 pw3 
> > echo $user1 
> > I tried in below ways but it is not working 
> > echo $usr 
> > export $usr ="$user1" 
> > echo $usr 
> > 
> > echo ${!$usr} 
> > echo ${!usr} 
> > echo $"$usr" 
> > echo `echo $"$usr"` 
> > can someone help.thanks in advance 
> > 
> > 
> >       
> > --
> > //www.freelists.org/webpage/oracle-l
> > 
> > 
> 
> -- 
> 
> 
> Met vriendelijke groet,
> Martijn Bos
> (06 39477001)
> 
> 
> --
> //www.freelists.org/webpage/oracle-l
> 
> 
> --
> //www.freelists.org/webpage/oracle-l
> 
> 

-- 


Met vriendelijke groet,
Martijn Bos
(06 39477001)


--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l


Other related posts: