Ruby on Rails Saturday, October 30, 2010

Hi ,


I am trying to connect to a SFTP server on my machine running using
WinSSHD. The port on which it is running is 22. I am unable to make a
connection to this port using ruby Net:sftp and Net:SSH libraries.
Here are both the codes:
==============================================================
#Option 1
require 'net/sftp'
Net::SFTP.start('192.168.1.3',:port =>22,:user=> 'sri', :password =>
'root') do |sftp|
sftp.upload!("c:\u.txt", "/")
end

=============================================================

=============================================================
#option 2
require 'net/ssh'
require 'net/sftp'

Net::SSH.start
('192.168.1.3',:password=>'root',:port=>22,:username=>'sri') do |ssh|
ssh.sftp.connect do |sftp|
Dir.foreach('.') do |file|
puts file
end
end
end
=============================================================

In both above examples i see that connection is taking place at random
ports instead of 22. Is something wrong with the code. Why it is not
taking the port i have specified??

Pls help

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment