LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2006, 10:12 AM   #1
jonlake
Member
 
Registered: Apr 2004
Distribution: Slackware 11.0, Gentoo
Posts: 252

Rep: Reputation: 31
Perl password input


I am taking arguments from stdin, an LDAP username and password. How can I get the input for the password to not display on the console. Example, when you su and are prompted for the password, it doesn't display it as you type. Is there a way to do this? I haven't found anything yet.

Cheers
 
Old 02-27-2006, 10:32 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You need to switch the terminal to raw mode and disable the echoing of characters. The only way I know of to do this (in PERL) is with the curses library.
 
Old 02-27-2006, 12:25 PM   #3
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
http://perldoc.perl.org/perlfaq8.htm...-a-password%3f
 
Old 02-27-2006, 01:44 PM   #4
jonlake
Member
 
Registered: Apr 2004
Distribution: Slackware 11.0, Gentoo
Posts: 252

Original Poster
Rep: Reputation: 31
Solution

I have figured this out. It is fairly easy, I just didn't know what I was looking for.

use Term::ReadKey;
ReadMode 2;
Get STDIN;
ReadMode 0;
 
Old 02-27-2006, 03:59 PM   #5
DanTaylor
Member
 
Registered: Jan 2006
Distribution: Debian Sarge
Posts: 265

Rep: Reputation: 30
IO::Prompt is a better way to do this.
The above method will eliminate all echoing

Last edited by DanTaylor; 02-27-2006 at 04:01 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard Input in Perl Program eachow Linux - General 2 11-17-2005 12:16 AM
perl input field separator Tinkster Programming 5 10-18-2004 04:08 PM
script and password input Rex_chaos Linux - General 1 07-22-2003 03:04 PM
perl input? andox Programming 1 06-25-2003 05:41 AM
console input in perl! farhanali Programming 7 06-12-2003 02:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration