[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: :SSH expect like interface

Felix Windt

4/26/2007 12:19:00 PM

I would suggest looking into using keys instead of passwords, and leveraging
agent forwarding. That should get you around the entire problem.

-----Original Message-----
From: Manish Sapariya [mailto:manishs@gs-lab.com]
Sent: Thursday, April 26, 2007 1:57 AM
To: ruby-talk ML
Subject: Net::SSH expect like interface

Hi All,
I have been looking for expect like interface for Net::SSH lib,
but apparently there is none.

Net::SSH is working fine for me except one place I need to check
the scp command prompt and send the password. (Invoking scp on
the machine to which I have ssh'ed).

Can somebody on list, provide some guidelines as to how can this
be achieved.

- I tried sending the password blindly to the popen session once
i get on_success or on_stderr callback. However this seems to be
not working. The log says..

--------snippet of the log......
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- connection.driver:
CHANNEL_SUCCESS recieved (1)
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- transport.session: sending
message >>"^\000\000\000\000\000\000\000\tpassword\n"<<
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- transport.session: waiting for
packet from server...
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 --
transport.incoming_packet_stream: reading 8 bytes from socket...
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 --
transport.incoming_packet_stream: packet length(60) remaining(56)
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 --
transport.incoming_packet_stream: received:
"_\000\000\000\001\000\000\000\001\000\000\000&Permission denied, please
try again.\r\n"
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- transport.session: got packet
of type 95
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- connection.driver:
CHANNEL_EXTENDED_DATA recieved (1:1:"Permission denied, please try
again.\r\n")
[DEBUGrequesting result of password
--> Permission denied, please try again.

requesting result of password
--> Permission denied, please try again.

requesting result of password
--> Permission denied (publickey,gssapi-with-mic,password).

requesting result of password
process finished with exit status: 1
] Thu Apr 26 14:05:48 +0530 2007 -- transport.session: sending message
>>"^\000\000\000\000\000\000\000\tpassword\n"<<
[DEBUG] Thu Apr 26 14:05:48 +0530 2007 -- transport.session: waiting for
packet from server...
--------

What I think is that there are these extra keysequence that are being
passed to the sever.
Do I need to emulate any kind of terminal for this to work.

What will be the best approach to implement expect like interface to
Net::SSH if at all
I can't get this working with existing functinoality.

Any pointer will be greatly appreciated.
Thanks and Regards,
Manish