Solved

masking password in shell script

Posted on 2004-04-27
1
1,811 Views
Last Modified: 2013-12-04
i am accepting password from the user in a shell script andstoring it into a temporary variable.
but it is shown on the screen while inputing.
how do i mask it or do not show it on the screen.
i know there is some redirection method.
i u please help me remember it.
thanks in advance.
0
Comment
Question by:praveen_bakare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Droby10 earned 20 total points
ID: 10928449
the following makes use of stty to control the terminal in a bash script, but you should be able to encapsulate the password handling in any language in the same manner.


#!/usr/local/bin/bash

echo -n "Username: "
read username
stty -echo
echo -n "Password: "
read passwd
stty echo
echo "$username:$passwd"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, a new law in my state forced us to get a top-to-bottom analysis of all of our contract client's networks. While we have documentation, it was spotty at best for some - and in any event it needed to be checked against reality. That was m…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question