From: Seid Rudy Date: 2006-09-14T01:49:39+09:00 Subject: Re: calling scp from ruby Pau Garcia i Quiles wrote: > On Thursday 07 September 2006 22:29, Joel VanderWerf wrote: >> Pau Garcia i Quiles wrote: >> > Why won't you use Net::SFTP instead of calling the external scp? >> >> I can guess one reason. Net::SFTP doesn't work with key-based >> authentication, only passwords, and there is no password given in OP's >> code.... >> >> I hope that I am wrong and that this has changed recently. > > Actually, it works with key-based authentication: > > require 'net/ssh' > require 'net/sftp' > > Net::SSH.start( '192.168.1.37', > :username=>'pgquiles' > ) do |session| > > session.sftp.connect do |sftp| > sftp.put_file("backup.tar.bz2", > "/media/hda3/backup.tar.bz2") > end > end I get this error, not sure why? ---- code ------------- require 'rubygems' require_gem 'net-ssh' require_gem 'net-sftp' Net::SSH.start( 'host','user','password') do |session| session.sftp.connect do |sftp| sftp.put_file("#{log}", "#{remotesqlfolder}/#{date_folder}.log") end end ---- end of code ------ --- error ------------- /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/userauth/services.rb:129: warning: `*' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/connection/driver.rb:74: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:130: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:131: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:139: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:140: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:141: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/open.rb:142: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/popen3.rb:143: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/service/process/popen3.rb:162: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/protocol/driver.rb:105: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/protocol/driver.rb:106: warning: `&' interpreted as argument prefix /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/connection/driver.rb:378: warning: instance variable @processing_data_requests not initialized /usr/lib/ruby/gems/1.8/gems/net-ssh-1.0.10/lib/net/ssh/connection/channel.rb:495: warning: instance variable @on_window_adjust not initialized /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/operations/abstract.rb:64: warning: `*' interpreted as argument prefix --- end of error ------ -- Posted via http://www.ruby-forum.com/.