Idea for DB Password in Shell Scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Idea for DB Password in Shell Scripts
# 1  
Old 03-20-2009
Bug Idea for DB Password in Shell Scripts

I work in an environment where we have a Oracle DB Server on a AIX box. There are several batch scripts that load and execute on the database. The DBA wants to periodically change the password. Ideally I would like to have one common place to maintain the database as it is changed. I was thinking the .profile, however I would like do do something more secure and less obvious. Does anyone have any suggestions on how to securely store a password to be used in shell scripts?
# 2  
Old 03-20-2009
Of course, the first recommendation is not to keep passwords in files. Having said that, one way I've seen used is to store the password in an executable script that accepts a parameter. Put the script somewhere down a tree, name it something non-descript and make it only readable/executable by the db user and put it in a directory only accessible by that user. Use a case statment to return the password based on the input of the database name. Also, check to see if it is an automated process (scheduler, cron, etc) that is executing it, and if not, send the login user's name to the logger facitility.

Code:
case $1 in
  db1)
    echo mypass;;
  db2)
    echo myotherpass;
esac

user check and log statement...

Padow
# 3  
Old 03-20-2009
At our company we store the password in an encrypted file, available only through an internally developed utility. This utility will only export the password (and other connect information) to the environment if it doesn't have a TTY connected, which is only the case when started through cron (or something similar)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

1 Script Not Sending Password - Other Scripts OK

I am building FTP Script on my Bluehost VPS Server. I have several and all work great except this one.... I think there are two issues .. One with the command and One with "$" in the password. #!/bin/sh HOST=invtransfer@52.44.151.220 USER=invtransfer PASSWORD=XXX$XXX - $ is real in... (3 Replies)
Discussion started by: Wrjames2
3 Replies

2. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

3. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

4. Shell Programming and Scripting

root password in SH scripts

Hi Everybody! I have to make my script more automatic as possible! In this, a have to mount a usb pen drive into a Blade (Solaris 2.8), and the only away I know to do it, is becoming a SuperUser (root). But unfortunately, when I become a SuperUser inside the script, it doesn't let me to put... (1 Reply)
Discussion started by: roosse77i
1 Replies

5. Shell Programming and Scripting

b-shell: any better idea for this one?Thanks!!

I'm new to the script programming and I have this piece of code (repeatedly used) in my program: while : do ................ ans=`ckyorn -p "Do you want to continue?"` if || || || ; then break elif || ; then echo "Aborting..." exit... (2 Replies)
Discussion started by: bluemoon1
2 Replies

6. AIX

Shell Scripts

I would like to seek some expertise of all our AIX experts on board. 1) I would like know how to get a return exit code of a command. I found that there are exist code for each and every command run in AIX but I just can't get the return code from my scripts. A=`cp /home/abc/abc.txt... (7 Replies)
Discussion started by: kwliew999
7 Replies

7. Shell Programming and Scripting

Echo escaped \c in SH Shell Any Idea

Hi All, I have got an echo statement with "\c" in it to avoid getting into a newline. Ths script is using #!\bin\sh Any idea what could make it to escape "\c" (4 Replies)
Discussion started by: asami
4 Replies

8. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

9. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

10. Shell Programming and Scripting

shell scripts

Hi! I have added a line into /etc/profile which looks like- date > $HOME/.lastloggedon This puts a file lastloggedon into everyones directory who has logged in recently. The trouble I am having is getting the information back out. I was hoping there was a command using find which brought... (1 Reply)
Discussion started by: karenshaw
1 Replies
Login or Register to Ask a Question