If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > hide DB2 password in the ps -ef command while executing the script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-11, 04:29
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
hide DB2 password in the ps -ef command while executing the script

Hi,

I need to hide the db2 password

Quote:
db2 -tx +p <<EOF1

connect to ${DBALIAS} user ${user} using ${pwd};
In the above scenario, any one can see the password by giving ps -ef while its running or in the log.

So I want a best possible way to hide this.

Ur help is highly appreciated
Reply With Quote
  #2 (permalink)  
Old 12-08-11, 09:14
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Is this a script or interactive session?

Andy
Reply With Quote
  #3 (permalink)  
Old 12-08-11, 09:33
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
hide DB2 password in the ps -ef command while executing the script

This is script
which will run automatically thru cron or Tivoli Manager

Please help me to overcome this
Reply With Quote
  #4 (permalink)  
Old 12-08-11, 09:52
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Let me get this straight. You have a script that has the password in it unencrypted where anyone can read it, and you are worried that they will get a glimpse of it with ps. I think you need to figure a different way.

Andy
Reply With Quote
  #5 (permalink)  
Old 12-08-11, 10:04
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
Yes... but i dont have any idea of the different way....
Reply With Quote
  #6 (permalink)  
Old 12-08-11, 10:06
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Is the script running on the DB2 server? Which user is running the script?

Andy
Reply With Quote
  #7 (permalink)  
Old 12-08-11, 11:30
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
hide DB2 password in the ps -ef command while executing the script

the script is running on AIX 6.1 Version. And DB2 sits on AIX

The script is scheduled in Tivoli. The script is having 777 permission.

Last edited by db2_unix_help; 12-08-11 at 11:40.
Reply With Quote
  #8 (permalink)  
Old 12-08-11, 12:39
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Which user is running the script?

Andy
Reply With Quote
  #9 (permalink)  
Old 12-09-11, 00:26
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
hide DB2 password in the ps -ef command while executing the script

Batch user.

The scripts will be running in batch mode
Reply With Quote
  #10 (permalink)  
Old 12-09-11, 10:35
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Since you are running the script on the server where DB2 resides, it may be possible to not use a password at all. I do not know AIX, but this works on linux. Just make sure that the DB2 environment is set up for the user.

Andy
Reply With Quote
  #11 (permalink)  
Old 12-11-11, 23:29
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
hide DB2 password in the ps -ef command while executing the script

Hi Andy,

can you give me an example....

because in my case its not working without password.
Reply With Quote
  #12 (permalink)  
Old 12-12-11, 10:00
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Try doing this:

1) open a terminal session on the server as the Batch User
2) Issue "connect to DBALIAS"

What happens?

Andy
Reply With Quote
  #13 (permalink)  
Old 12-12-11, 19:57
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Basically there may not be any feasible solution as long as you set permission to 777. Only thing seems possible not to use any password. The job runs local, you do not have to provide a password as Andy said.

However if you are able to set permissions to 700, which should be possible in most cases, .psec file method is most appropriate to connect to databases, even on remote server.

As long as you are on trusted domain, db2 should not require any password.

Regards
Reply With Quote
  #14 (permalink)  
Old 12-13-11, 01:02
wolaos123 wolaos123 is offline
Registered User
 
Join Date: Nov 2011
Location: Shen Zhen,China
Posts: 37
1 if the AUTHENTICATION set as SERVER or SERVER_ENCRYPT
# db2 get dbm cfg|grep AUTHENTICATION
Database manager authentication (AUTHENTICATION) = SERVER_ENCRYPT

then there is no need set the password in the connect line

2 generate RSA Public and Private keys for SCP,SSH,script between the servers

3 Alternatively,
connect to ${DBALIAS} user ${user} using `cat /some/dir/passwd_file`;
Reply With Quote
  #15 (permalink)  
Old 12-13-11, 03:28
db2_unix_help db2_unix_help is offline
Registered User
 
Join Date: Dec 2011
Posts: 9
Hi Andy/DB Finder,

I'm getting the below error message while trying to connect

$ db2 connect to <dbalias>
SQL30082N Security processing failed with reason "3" ("PASSWORD MISSING").
SQLSTATE=08001


Hi wolaos123,

I'm getting the below error message while trying to connect from the prompt without specifying the pwd.

$ db2 connect to <dbalias>
SQL30082N Security processing failed with reason "3" ("PASSWORD MISSING").
SQLSTATE=08001

<user>@<server>:<path> >
$ db2 get dbm cfg|grep AUTHENTICATION
Database manager authentication (AUTHENTICATION) = SERVER_ENCRYPT

Please give me an example for RSA Authentication.
Please help me on this.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On