Re: Hide the typing password in shell script (372 Views)
Reply
Occasional Visitor
sathish12345
Posts: 1
Registered: ‎05-20-2012
Message 1 of 3 (379 Views)

Hide the typing password in shell script

Hi,

 

In my shell script, I am connecting to oracle database and executing some queries. For that i am prompting the password to the user. But I want to hide the typing content(password) due to security reason. 

 

In bash , I can pass like "read -s password". But in my servers, bash kernal is not installed. Basic kernal only is there. How to solve this issue??

 

 

Please help me

Please use plain text.
Honored Contributor
Duncan Edmonstone
Posts: 5,676
Registered: ‎08-05-2000
Message 2 of 3 (372 Views)

Re: Hide the typing password in shell script

Surprised google didn't find you this:

 

echo "enter password: \c"

stty -echo

read pw

stty echo

 

And then the passowrd is stored in ${pw}


HTH

Duncan
Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,036
Registered: ‎02-23-2005
Message 3 of 3 (362 Views)

Re: Hide the typing password in shell script

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation