Solved

masking password in shell script

Posted on 2004-04-27
1
1,801 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The term "Bad USB" is a buzz word that is usually used when talking about attacks on computer systems that involve USB devices. In this article, I will show what possibilities modern windows systems (win8.x and win10) offer to fight these attacks wi…
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 video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now