Solved

masking password in shell script

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

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…
Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

15 Experts available now in Live!

Get 1:1 Help Now