Operating System - Linux
1751817 Members
5610 Online
108781 Solutions
New Discussion юеВ

How do I hide passwords in a perl script.

 
StanleySWLee
Advisor

How do I hide passwords in a perl script.

Hi all,
I'm having problem hiding my password entry from users vision. How can I solve it?

Rgds,
Stanley
6 REPLIES 6
H.Merijn Brand (procura
Honored Contributor

Re: How do I hide passwords in a perl script.

# perldoc -q password

will give you all the answers you need.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Steve Faidley
Valued Contributor

Re: How do I hide passwords in a perl script.

send an stty -echo before asking for the password. Then an stty echo after.
If it ain't broke, let me have a look at it.
StanleySWLee
Advisor

Re: How do I hide passwords in a perl script.

Dear all,

Currently i just read user input to a variable like below:

$password = ;

and run in solaris environment.

My objective is to hide from user when user input.

As I know the -stty command is just for shell script file. Is it?
H.Merijn Brand (procura
Honored Contributor

Re: How do I hide passwords in a perl script.

What is wrong with my answer? Did you try it?

It *literally* states your problem and gives the solution. We don't have to cut and paste the output here, do we?

I admit that Term::ReadKey is not a CORE module, but it will give you a portable way to disable the echo of characters entered.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
StanleySWLee
Advisor

Re: How do I hide passwords in a perl script.

Hi H.Merijn,

I do have try your statement and put it in my perl script and it dont reflect any changes that I had made. Or do I made any mistake? Pls advice.

FYI, I just need to mask a (a standard input) from user when the user input prompt in unix environment?

Thks and rgds,
Stanley
StanleySWLee
Advisor

Re: How do I hide passwords in a perl script.

Thanks to H.Merijn and Steve for your precious advice. Currently I'm using

system "stty -echo";

to mask off.

Thanks all