Questions tagged [net-sftp]

Net/SFTP is a ruby library for interfacing with native SFTP connections. It is related to Net/SSH, Net/SCP and others.

Net/SFTP is a ruby library for interfacing with native SFTP connections. It is related to Net/SSH, Net/SCP and others. Project Info

102 questions
2
votes
1 answer

Passphrase Key-based authenication with net-sftp in Ruby

Based on question Key based authenication with net-sftp in Ruby, I can SFTP with key-based authentication using the following: Net::SFTP.start(host, "user", keys:['~/.ssh/my_key']) do |sftp| sftp.upload! "/local/file.tgz",…
MrDuk
  • 16,578
  • 18
  • 74
  • 133
2
votes
2 answers

Net::SFTP::Session can't run stat, apparently has a Nil channel

So I have some code that checks if there's a certain file on remote SFTP server: def size adapter.sftp.stat(path).size end where sftp is a Net::SFTP::Session object defined in this case as @sftp = Net::SFTP.start(host, username, password:…
2
votes
2 answers

Delete a file using Ruby SFTP `remove` and `remove!`

I am trying to old delete files from an FTP using Ruby net/sftp, but I keep getting an error saying the file does not exist. :error=>"Net::SFTP::StatusException (2, \"no such file\")" I can manually delete files when logging in using the same…
theUtherSide
  • 3,338
  • 4
  • 36
  • 35
2
votes
0 answers

How to detect Connection Closed error when transferring files in phpseclib

I have a PHP CLI daemon which is sending files via SFTP regularily to a flaky server, and before I fix the server I want to implement error handling in my script. After logging in succesfully, I run this command and it works about 70% of the time: …
Cocorico
  • 2,319
  • 3
  • 22
  • 31
2
votes
2 answers

How to Move a file to SFTP server using SharpSSH

need to move file from one folder to another on filezilla using Tamir.SharpSsh.Sftp. Tamir.SharpSsh.Sftp client = new Tamir.SharpSsh.Sftp(address, username, password); client.Connect(); client.? // for move file from one folder to…
Aditya
  • 44
  • 1
  • 12
2
votes
1 answer

Not able to use Net::SFTP module in Perl

I am using perl, v5.10.1 on my Linux Ubuntu machine. I tried to install Net::SFTP module through cpan prompt but its giving the below errors for past 2 days. warning: Warning: no success…
KnowledgeSeeeker
  • 620
  • 1
  • 9
  • 14
2
votes
1 answer

Getting Ruby NET::SCP or NET::SFTP to use different ciphers

I am trying to force Capistrano v2 to use an arcfour cipher on uploading. Snippet from a function overloading upload: puts "Implementing rsync deploy" servers = find_servers_for_task(current_task) upload(from,to,options.merge(:hosts =>…
Electrawn
  • 2,254
  • 18
  • 24
2
votes
1 answer

ruby net sftp : fastest way to get list of files

I am using ruby Net-sftp gem,I need to download large number of small files before I download I need to make sure to get a list of files in the given directory. In order to do that I am using sftp.dir.entries('folder path').size to get list of file…
Lohith MV
  • 3,798
  • 11
  • 31
  • 44
2
votes
2 answers

Is there a better way to check file size using SCP before downloading?

I have this code to download a file from a remote machine, but I want to limit it to files that are less than 5MB. So far the code works. but is there a better way to check the filesize before downloading? Net::SCP.start(hname, uname, :password =>…
user2300908
  • 165
  • 1
  • 1
  • 12
2
votes
1 answer

Ruby Net::SFTP error when using session.exec

I'm getting some unexpected behavior from Net::SFTP in Ruby (ruby 1.9.3p194). Variant #1 fails. It starts an SFTP block and uses session.exec! to run a shell command. Net::SFTP.start(...) do |sftp| sftp.session.exec! "mkdir -p ..." # Fails here. …
FMc
  • 41,963
  • 13
  • 79
  • 132
2
votes
1 answer

Ruby SFTP returns "Net::SSH::Disconnect: disconnected: Failed to read binary packet data! (2)"

I have this in ruby 1.9.3: Net::SFTP.start(ENV['SFTP_HOST'], ENV['SFTP_USERNAME'], password: ENV['SFTP_PASSWORD'], key_data: [ENV['SFTP_KEY']], keys_only: true) do |sftp| sftp.upload!(StringIO.new("testing"), "/text.txt") end It appears to do the…
Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
2
votes
1 answer

Ruby: CSV encoding: IlegalFormatError

I'm parsing a CSV file that I've pulled from an FTP site. I want to parse the CSV and extract some specific fields to store in the database. I encounter some encoding I don't understand and I believe CSV.parse also isn't expecting the…
Sly
  • 743
  • 13
  • 38
2
votes
2 answers

sftp net drive ssh server settings - get error 10058

I am trying out Eldos's SFTP Net Drive to map a drive to a virtual Ubuntu server. I works great when authenticating with a password. I have tried the normal/typical methods for configuring Key-based access. However, I receive error 10058. I have…
Larry Eitel
  • 1,397
  • 5
  • 19
  • 37
1
vote
0 answers

Rails and net-ssh/sftp

I am developing an app that need to be constantly connected to ssh. Every action open a new ssh connection and new sftp-server on the target host, I was wondering if there is a solution for keep session ssh/sftp without create new connection. With…
tree
  • 75
  • 7
1
vote
0 answers

could not settle on kex algorithm - SFTP connection failed

Tried to connect SFTP server using RSA private key with a ruby script. It's not connecting. But it's working using Filezilla. Code example: require 'net/sftp' sftp = Net::SFTP.start('hostname', 'user', password: '', port: 'port', keys:…