masking or encrypting in shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers masking or encrypting in shell script
# 1  
Old 02-07-2006
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 password for the login:$login"
read passwd
......... the scripts then proceeds to telnet a list of IPs and do some executions on the servers....


In this case, as the user types the password, it is displayed on the screen. Is there a way wherein the password that is being typed is not seen or can be masked/encrypted? Please let me know.

Thanks.
Shrish
# 2  
Old 02-07-2006
use, ( to turn off password visibility )

Code:
stty -echo

prior to reading the password

and enable it back by

Code:
stty echo

# 3  
Old 02-08-2006
Thanks a lot buddy...its seems so simple now!!! thanks a ton.
# 4  
Old 02-16-2006
Bug

Smilie In read command also have some option's for this
-s is the option that hide the input
# 5  
Old 02-16-2006
Quote:
Originally Posted by sabari
Smilie In read command also have some option's for this
-s is the option that hide the input
no, -s option in read is not quoted for that
it would save a copy of the value read in the history file
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies

2. Shell Programming and Scripting

Issues Masking(Encrypting) a string

Hi, echo "mypassword" | crypt "tom" But this is giving me some unreadable strange looking characters / symbols never seen before which I cant even copy and save in a file. SunOS mymac 5.10 Generic_150400-26 sun4v sparc sun4v Can you help me with encrypting the password "mypassword" in... (15 Replies)
Discussion started by: mohtashims
15 Replies

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

4. Shell Programming and Scripting

Masking Password from within a Bash Shell Script

Is there a way to mask the password inside of a script to minimize the impact of a comprimised server? So ssh -o "PasswordAuthentication no" -o "HostbasedAuthentication yes" -l testuser 192.168.3.1 "mysqldump --opt --all-databases -u root -pPassword| gzip" > $backup_dir/mysqldump.gz a... (2 Replies)
Discussion started by: metallica1973
2 Replies

5. Shell Programming and Scripting

Encrypting bash script

I used shc for encrypting a bash script. It worked fine, but the issue is that, when I run the script using ./test.sh.x in a screen and after getting out of the screen when I type "ps aux" I can see the source code from the command prompt and also the commands being executed as plain text. See... (1 Reply)
Discussion started by: anilcliff
1 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. Solaris

Encrypting a script......

Hiiiiii..... every one..... I have written a script, and i want to make that script confidential.So that, only i can see that script. I am using " crypt " command in solaris 9, to encrypt that script.But when i am executing this... (6 Replies)
Discussion started by: prashantshukla
6 Replies

9. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: bubba112557
1 Replies

10. UNIX for Dummies Questions & Answers

Masking input in a shell script

How do I prevent user input from being displayed in running script (e.g. when entering a password)? Thanx, Aaron (2 Replies)
Discussion started by: Spetnik
2 Replies
Login or Register to Ask a Question