Solved

masking password in shell script

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
No security measures warrant 100% as a "silver bullet". The truth is we also cannot assume anything but a defensive and vigilance posture. Adopt no trust by default and reveal in assumption. Only assume anonymity or invisibility in the reverse. Safe…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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