Re: Hide the typing password in shell script (598 Views)
Reply
Occasional Visitor
Posts: 1
Registered: ‎05-20-2012
Message 1 of 3 (615 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

Honored Contributor
Posts: 5,684
Registered: ‎08-05-2000
Message 2 of 3 (608 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
Honored Contributor
Posts: 9,112
Registered: ‎02-23-2005
Message 3 of 3 (598 Views)

Re: Hide the typing password in shell script

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.