Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Concealing keyboard input? Or how to display *****'s instead of text

Hi,
I'm writing a bash script to run under Cygwin to change users passwords on a Windows domain controler. My script uses the Windows "net user" command and I feed it the password as a variable.

In my script I'm using "read" to capture keyboard input into a variable but ofcourse the password is displayed on the screen. Is there a way I can conceal the password input with *****'s?
0
veedar
Asked:
veedar
2 Solutions
 
grsteedCommented:
This isn't exactly what your looking for but it does blank out the password entry.

# Turn off echo
stty -echo
echo -n "Enter Password: "
read password
stty echo

The last line turns the echo back on.

Cheers,
Gary
0
 
manish_regmiCommented:
How about using expect.

expect -re "Password '.*': "

http://expect.nist.gov/

regards
Manish Regmi
0
 
veedarAuthor Commented:
Thanks, blanking it out will work for me.

And a relevant expect doc here....
http://expect.nist.gov/doc/bgpasswd.pdf
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now