Re: Hide the typing password in shell script (552 Views)
Reply
Occasional Visitor
sathish12345
Posts: 1
Registered: ‎05-20-2012
Message 1 of 3 (569 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
Duncan Edmonstone
Posts: 5,680
Registered: ‎08-05-2000
Message 2 of 3 (562 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
Steven Schweda
Posts: 9,091
Registered: ‎02-23-2005
Message 3 of 3 (552 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.