The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How Do I Hide the Password in a Script samd Shell Programming and Scripting 6 11-22-2006 02:38 AM
Want to hide password arpitk Shell Programming and Scripting 1 09-29-2006 05:42 AM
Hide oracle password on unix process list acheepi Shell Programming and Scripting 3 10-06-2005 06:25 PM
How to hide password on Linux? nir_s Shell Programming and Scripting 2 02-09-2005 09:24 AM
hide password typing ivancheung High Level Programming 2 09-30-2004 10:05 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-26-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
Hide Password

Hi,
I am trying to write a shell script to call ftp program to send files to windows shared drive.
I don't want my user to directly deal with ftp program, so I use shell as an interface to allow them to give userID and password.
Is there anyway that I can hide the password when user input within shell program just like when we log into Unix?


Any help would be appreiciated!
Reply With Quote
Forum Sponsor
  #2  
Old 10-26-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
#! /usr/bin/ksh

print -n "Enter password - "
stty -echo
read PASSWORD
stty echo
print

Then just use $PASSWORD where you need it.
Reply With Quote
  #3  
Old 10-27-2005
Registered User
 

Join Date: Feb 2004
Posts: 91
Quote:
Originally Posted by Perderabo
#! /usr/bin/ksh

print -n "Enter password - "
stty -echo
read PASSWORD
stty echo
print

Then just use $PASSWORD where you need it.
Another option depending on the shell is:
echo "Enter password"
read -s PASSWORD
Reply With Quote
  #4  
Old 10-27-2005
whatisthis's Avatar
Registered User
 

Join Date: Aug 2004
Posts: 175
stty -echo

Thanks for all the help!!
Reply With Quote
  #5  
Old 07-21-2008
Registered User
 

Join Date: Jul 2008
Posts: 3
You can type
echo Please enter the password
stty -echo
read $passwd
stty echo

also you can put *** instead of password on console
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0