I am trying to get a script that works both in the native Windows shell and in the cygwin shell (via ssh), which requests and reads the password entered by the user. So far I have tried the following methods:
- using Term :: ReadKey and setting ReadMode to "noecho"
- RESULT: returns
GetConsoleMode failed and exits
- using Term :: ReadPassword :: Win32
- RESULT: hangs and never offers an invitation or reads input
- using IO :: Prompt
- RESULT: returns
Cannot write to terminal error and exits
- using Term :: InKey
- RESULT: returns an error
Not implemented on MSWin32: The handle is invalid and exits
They all work in their native Windows shell (command line or command shell), but none of them work when I'm in an ssh session on the server.
Indeed, this is what interests me the most and make it work in a remote ssh session.
I get ssh through cygwin installed on a Windows server (2003 R2). I use strawberry perl, not cygwin perl (cygwin perl breaks up other perl scripts that I need to run natively on Windows and not through ssh).
My best guess is that cygwin + Windows is screwed with strawberry perl, which cannot determine what environment it is in. I am studying alternative sshd + windows solutions to explore this.
These are all the methods that I could find in my search. Does anyone else have any methods to hide the user input that they can offer?
sgsax
source share