Class | Net::SSH::Connection::Session |
In: |
lib/net/sftp.rb
lib/net/sftp.rb |
Parent: | Object |
A convenience method for starting up a new SFTP connection on the current SSH session. Blocks until the SFTP session is fully open, and then returns the SFTP session.
Net::SSH.start("localhost", "user", "password") do |ssh| ssh.sftp.upload!("/local/file.tgz", "/remote/file.tgz") ssh.exec! "cd /some/path && tar xf /remote/file.tgz && rm /remote/file.tgz" end
# File lib/net/sftp.rb, line 63 63: def sftp(wait=true) 64: @sftp ||= begin 65: sftp = Net::SFTP::Session.new(self) 66: sftp.connect! if wait 67: sftp 68: end 69: end
A convenience method for starting up a new SFTP connection on the current SSH session. Blocks until the SFTP session is fully open, and then returns the SFTP session.
Net::SSH.start("localhost", "user", "password") do |ssh| ssh.sftp.upload!("/local/file.tgz", "/remote/file.tgz") ssh.exec! "cd /some/path && tar xf /remote/file.tgz && rm /remote/file.tgz" end
# File lib/net/sftp.rb, line 63 63: def sftp(wait=true) 64: @sftp ||= begin 65: sftp = Net::SFTP::Session.new(self) 66: sftp.connect! if wait 67: sftp 68: end 69: end