Encrypting a password for shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Encrypting a password for shell script
# 1  
Old 11-08-2004
Encrypting a password for shell script

All,

I want to encrypt a database system administration password into a file or environment variable. Then, I want to decrypt the password from the file or environment variable so nobody sees the clear text password.

For example, I have the database password of developement.
I need to execute the following line to access the database:
Code:
isql -Usysadmin -Pdevelopment

I want users not to see the development password in clear text.

Thanks!

Last edited by Yogesh Sawant; 08-11-2010 at 01:14 AM.. Reason: added code tags
# 2  
Old 11-08-2004
One way encryption is fairly straight forward with Unix, and can be achieved using the "crypt" command (if available) or system call, or using the crypt() function in Perl, PHP and others. The problem with this is exactly that - it's one way. You can't decrypt a "crypt"ed password (otherwise /etc/{passwd,shadow} would be useless as authentication mechanisms).

The problem is that the -P option to isql expects the "true" password, not an encrypted variant. It may or may not be visible in ps output listings.

Some related threads that might assist you can be found here:
https://www.unix.com/shell-programming-and-scripting/5458-hiding-password-ps.html?s=
https://www.unix.com/unix-for-dummies-questions-and-answers/13993-hiding-login-password-process.html?s=

I do a lot of PHP/PostgreSQL Web Development, and I request the plain text login over https, then the "login" PHP script encrypts the password and checks it against the encrypted password stored within the "user" table (or whatever it may be called). Not too sure if you could create some kind of web enabled front end for Informix - we use curses for our Informix frontend at work.

Hope something there was of use!

Cheers
ZB
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Encrypting or maksing password in cron

Hello experts, I am an PLM application admin, use AIX/SOlaris servers where application is installed to schedule a cron in my system this what i do Login to AIX/Unix system using an OS account, Schedule a service to execute the required script - The script will have a PLM utility and... (4 Replies)
Discussion started by: kraghum
4 Replies

2. Shell Programming and Scripting

Shell Script for encrypting/decrypting text file

Hello, I am a newbie in Shell scripting. At the moment, I have a program written in C++ which gives an output file in text format. I would like to write a shell program which can take that output file and encrypt it and later if needed I want to decrypt it. Could someone please help or... (3 Replies)
Discussion started by: Tanin
3 Replies

3. Shell Programming and Scripting

Encrypting password

Hello All, I need to accept a password from the user and validate it, without having to hard-code it anywhere. Any ideas? (3 Replies)
Discussion started by: optimus_1
3 Replies

4. Shell Programming and Scripting

Encrypting the password

Iam using the teradata... and running the scripts in unix, I wan to encrypt the teradata password in Unix... my hostname is : bprod usename: KRN777 passwrd: passwrd can ant one tell me the exact command to encrypth the passwrd.... thanks, (5 Replies)
Discussion started by: nani1984
5 Replies

5. Shell Programming and Scripting

Encrypting the login password on Solaris 10

Hi, Could you pls. help me in encryting a database password on Solaris 10 Box. eg : username : test password : t est123 The request is to encrypt the test123 so that no one can understand the what the password is ? thanks (7 Replies)
Discussion started by: krackjack
7 Replies

6. Shell Programming and Scripting

Shell script for encrypting a string

Hi, I am new to Unix server and shell scripting.I want to encrypt username/password using shell script.I know that there's a Crypt command to encrypt but it is not installed in my unix server and cannot be installed due to some reason.So i want the shell script of the crypt command or is there... (3 Replies)
Discussion started by: Princessp
3 Replies

7. Shell Programming and Scripting

Encrypting a shell script

Hi all, I have one script with me , say automate.sh. I would like to encrypt it, so that no one can see the contents of this script. Can anyone guide me to encrypt/decrypt this script? Regards, akash (1 Reply)
Discussion started by: akash_mahakode
1 Replies

8. 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

9. UNIX for Dummies Questions & Answers

masking or encrypting in shell script

Hi folks, I am writing a script which asks the user to enter a user name and password to telnet and logon to some other machine. The script promts the user to enter the login name and password as below. echo "Enter the login name to be used to login on the machine" read login echo "Enter the... (4 Replies)
Discussion started by: dshrish
4 Replies

10. AIX

Encrypting password

I have a strange question for someone regarding the AIX 5.2 environment. Here is the scenerio: I have a script that is running a menu full of options. 1. I like food 2. I don't like food Enter Option:_ Enter userID:_ Enter Password:_ (The menu is conversational only so go with me on... (6 Replies)
Discussion started by: Justman
6 Replies
Login or Register to Ask a Question