ftp - Ruby Net::SFTP upload hangs -
i using net-sftp gem upload file ftp server. here's code:
require "net/sftp" net::sftp.start(url, username, password: password) |sftp| sftp.upload!(file_path, "/") end
it hangs @ upload line, , times out error net::ssh::disconnect: connection closed remote host
. able connect via sftp using filezilla using same url, username, , password.
i tried running non-block version verbose: :debug
as well:
sftp = net::sftp.start(test.ftphost.com, ftp_username, password: ftp_password, verbose: :debug)
^ produced output shows connection good:
i, [2015-04-29t10:32:51.381339 #25769] info -- net.ssh.connection.session[3fc8a502c24c]: channel_success: 0 d, [2015-04-29t10:32:51.381429 #25769] debug -- net.sftp.session[3fc8a5025d70]: sftp subsystem started
then entered following:
sftp.upload!("/users/marina/desktop/test.png", "/")
the output stuck this:
i, [2015-04-29t10:32:55.035471 #25769] info -- net.sftp.session[3fc8a5025d70]: sending open packet (0) d, [2015-04-29t10:32:55.035740 #25769] debug -- tcpsocket[3fc8a4cf464c]: queueing packet nr 12 type 94 len 44 d, [2015-04-29t10:32:55.036149 #25769] debug -- tcpsocket[3fc8a4cf464c]: sent 68 bytes d, [2015-04-29t10:32:55.119070 #25769] debug -- tcpsocket[3fc8a4cf464c]: read 52 bytes d, [2015-04-29t10:32:55.119356 #25769] debug -- tcpsocket[3fc8a4cf464c]: received packet nr 11 type 96 len 28 i, [2015-04-29t10:32:55.119470 #25769] info -- net.ssh.connection.session[3fc8a502c24c]: channel_eof: 0 d, [2015-04-29t10:32:55.195747 #25769] debug -- tcpsocket[3fc8a4cf464c]: read 120 bytes d, [2015-04-29t10:32:55.196037 #25769] debug -- tcpsocket[3fc8a4cf464c]: received packet nr 12 type 98 len 44 i, [2015-04-29t10:32:55.196176 #25769] info -- net.ssh.connection.session[3fc8a502c24c]: channel_request: 0 exit-status false d, [2015-04-29t10:32:55.196445 #25769] debug -- tcpsocket[3fc8a4cf464c]: received packet nr 13 type 97 len 28 i, [2015-04-29t10:32:55.196527 #25769] info -- net.ssh.connection.session[3fc8a502c24c]: channel_close: 0 d, [2015-04-29t10:32:55.196743 #25769] debug -- tcpsocket[3fc8a4cf464c]: queueing packet nr 13 type 97 len 28 d, [2015-04-29t10:32:55.196806 #25769] debug -- net.sftp.session[3fc8a5025d70]: sftp channel closed d, [2015-04-29t10:32:55.197022 #25769] debug -- tcpsocket[3fc8a4cf464c]: sent 52 bytes
any ideas?
what file_path?
if using relative path, going relative directory app starts.
the following may useful:
dir.pwd dir.entries('.')
perhaps verbose: debug
helpful.
also:
i'm having problems using net::sftp.start block , have had make inline approach.
sftp = net::sftp.start(host, username, ssh_session_options) sftp.upload!(file.path, remote_path) sftp.session.shutdown!
Comments
Post a Comment