Re: Question on input password on ssh prompt



On Sep 16, 2:31 am, Ben Morrow <b...@xxxxxxxxxxxx> wrote:
Quoth Mav <mluv...@xxxxxxxxx>:



Hi, all
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.
<snip>

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


.



Relevant Pages

  • RE: Using LWP to Browse a Perl Page
    ... On running the command install Crypt::SSLeay I found that the scripts ... the address points to a Perl script. ... Did you view source for the frame or the original page? ...
    (perl.beginners)
  • Re: installing 1.8.7
    ... tar xzvf ruby-1.8.6-p111.tar.gz ... sudo make install ... file created by the tarcommand and then zipped by the gzip ... Within that directory is a shell script named 'configure'. ...
    (comp.lang.ruby)
  • Re: Cant setup printer on remote workstation using WMI
    ... I was having the same problem, so based a script on rundll32 printui.dll ... command line as below. ... will install network printer for all users on a pc. ...
    (microsoft.public.scripting.wsh)
  • Re: osx neophyte: launch app?
    ... > I am trying to write a script to call Microsoft's Remote Desktop ... > BTW - I assume that the proper way to install it, ... Then use the open command: ...
    (comp.unix.shell)
  • Re: Problems trying to configure Linux laptop to print to Windows XP shared printer
    ... map to guest = Never ... check password script = ... enumports command = ... ldap delete dn = No ...
    (comp.os.linux.setup)