Re: Question on input password on ssh prompt
- From: Mav <mluvw47@xxxxxxxxx>
- Date: Mon, 17 Sep 2007 06:02:44 -0000
On Sep 16, 2:31 am, Ben Morrow <b...@xxxxxxxxxxxx> wrote:
Quoth Mav <mluv...@xxxxxxxxx>:
Hi, all<snip>
I am writing a perl script running on the XP, the machine already
have openssh installed. The script would call ssh command and send a
command to the remote host.
The code like.
However right after I made the system call for ssh, it prompts for the
password.
c:\>perl my.pl
Invoke command on host : somehost
enter password: <--- my program stopped right here waiting.
I understood that perl provides pm packages (in this case SSH) to
get this work done, but the script I am going to run, only will get
the perl installed and perl.dll, not extra module.
You can use PAR (from CPAN) to package a script plus all dependant
modules up into a single file that can be run with just perl installed.
It's really not worth avoiding the use of modules.
My question is:
1) Is that a way I can feed it the password without install any
module?, if so, how?
No. However, you can switch to public-key authentication, which doesn't
require you enter the password.
2) Or where I can find out more regarding input after prompt
waiting?
Err... under Unix, the answer is 'use a pty'. I don't know if it is even
possible to emulate this under Win32: it depends on exactly how ssh
prompts for the password.
Ben
Ben, Thanks for your input. I will look into PAR. I guess when after
the system call like
system("myapp.exe"), however, if myapp.exe is prompting for input, I
don't think perl will able to feed in the input then.
No. However, you can switch to public-key authentication, which doesn't
require you enter the password.
In fact, The actual script I am working actually first generates the
public key on the PC side(for that PC), then append the public key
into linux (.ssh/authorized_key) entry thru ssh command. So next time,
if the PC invokes a command from the PC to linux side thru ssh, it
will not prompt the password. Any suggestion?
Thanks,
Mav
.
- Follow-Ups:
- Re: Question on input password on ssh prompt
- From: J. Gleixner
- Re: Question on input password on ssh prompt
- References:
- Question on input password on ssh prompt
- From: Mav
- Re: Question on input password on ssh prompt
- From: Ben Morrow
- Question on input password on ssh prompt
- Prev by Date: Re: Send Carriage return
- Next by Date: FAQ 4.71 How do I determine whether a scalar is a number/whole/integer/float?
- Previous by thread: Re: Question on input password on ssh prompt
- Next by thread: Re: Question on input password on ssh prompt
- Index(es):
Relevant Pages
|