Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Net::Telnet can't send password message

Reply
Thread Tools

Net::Telnet can't send password message

 
 
born in USSR
Guest
Posts: n/a
 
      09-09-2009
Code:
require "net/telnet"

user_login='user1'
user_paswd='xxxxxx'
ssh_host='192.168.1.2'

tserv = Net::Telnet::new("Host" => "192.168.1.5",
"Timeout" => 10,
"Prompt" => /[$%#>] \z/n)

ans=tserv.login(user_login,user_paswd) # Successful authentication

tserv.cmd('ssh -l #{user_login} #{ssh_host}')do |c| # on the
screen:
puts c.to_s                             # ssh -l user1
192.168.1.2
end                                      # user1@192.168.1.2's
password:

tserv.close
i also tried
Code:
...
tserv.puts('ssh -l #{user_login} #{ssh_host}')
puts tserv.gets  # assumed that on screen i'll see
# 'user1@192.168.1.2's password:'
# but there were was nothing
tserv.puts user_paswd
...
but it doesn't work too.

how can i input password for ssh?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Rodrigo Bermejo
Guest
Posts: n/a
 
      09-09-2009
born in USSR wrote:
>
Code:
>       require "net/telnet"
>
>       user_login='user1'
>       user_paswd='xxxxxx'
>       ssh_host='192.168.1.2'
>
>       tserv = Net::Telnet::new("Host" => "192.168.1.5",
>                                        "Timeout" => 10,
>                               "Prompt" => /[$%#>] \z/n)
>
>       ans=tserv.login(user_login,user_paswd) # Successful authentication
>
>       tserv.cmd('ssh -l #{user_login} #{ssh_host}')do |c| # on the
> screen:
>        puts c.to_s                             # ssh -l user1
> 192.168.1.2
>       end                                      # user1@192.168.1.2's
> password:
>
>       tserv.close
>
>
> i also tried
>
Code:
>       ...
>       tserv.puts('ssh -l #{user_login} #{ssh_host}')
>       puts tserv.gets  # assumed that on screen i'll see
>                        # 'user1@192.168.1.2's password:'
>                        # but there were was nothing
>       tserv.puts user_paswd
>       ...
>
> but it doesn't work too.
>
> how can i input password for ssh?

Sanity check question:
why not doing the ssh connection directly from the host you are doing
the telnet (with net/ssh)?

If there's not a key associated with your telnet machine it would be
easier to connect directly using ssh

-r.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
born in USSR
Guest
Posts: n/a
 
      09-09-2009
Rodrigo Bermejo wrote:
>
> Sanity check question:
> why not doing the ssh connection directly from the host you are doing
> the telnet (with net/ssh)?
>
> If there's not a key associated with your telnet machine it would be
> easier to connect directly using ssh
>
> -r.

I know that it will be easy but
i can't do differently, it's caused by other requirements to the
program.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Rodrigo Bermejo
Guest
Posts: n/a
 
      09-09-2009
born in USSR wrote:
> Rodrigo Bermejo wrote:
>>
>> Sanity check question:
>> why not doing the ssh connection directly from the host you are doing
>> the telnet (with net/ssh)?
>>
>> If there's not a key associated with your telnet machine it would be
>> easier to connect directly using ssh
>>
>> -r.

> I know that it will be easy but
> i can't do differently, it's caused by other requirements to the
> program.


Then you need this:
http://linuxproblem.org/art_9.html


Ssh prevents you to send the password in "an automatic way".

-r.
<born in Mexico>
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
born in USSR
Guest
Posts: n/a
 
      09-10-2009
Rodrigo Bermejo wrote:
> Then you need this:
> http://linuxproblem.org/art_9.html
>
>
> Ssh prevents you to send the password in "an automatic way".
>
> -r.
> <born in Mexico>


thank's
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 1 01-16-2009 02:56 PM
Changing a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 2 01-16-2009 02:08 PM
Mail.SmtpMail.Send won't send to one of my addresses Nathan Sokalski ASP .Net 3 11-23-2005 09:25 PM
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM
Does Socket.send send all bytes? Chris Reay Ruby 2 11-04-2003 08:22 PM



Advertisments