Questions tagged [net-ssh]

A pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.

A pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2. http://net-ssh.rubyforge.org/ssh/v2/api/

207 questions
2
votes
1 answer

SSH Connections one after another, second one fails

I have code that requires me to connect to one server, rsync to a different server, then connect to the second server and run a bunch of commands on it. But without fail, the second SSH connection throws a 'do_open_failed': open failed (1)…
Magicmarkker
  • 1,063
  • 7
  • 25
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
3 answers

Using Ruby and SCP/SSH, how to determine if a file exists before uploading a copy

I'm uploading a file to a remote server using SCP, but what's the proper way of seeing if that file exists before doing so?
Zando
  • 5,473
  • 8
  • 30
  • 37
2
votes
0 answers

Net::SSH forward not working

I want to forward a port via Net::SSH like this: ssh = Net::SSH.start('host', 'user', config: true) ssh.forward.local(3333, 'localhost', 80) ssh.loop which to my understanding translates to the equivalent of: ssh user@host -L…
rausch
  • 3,148
  • 2
  • 18
  • 27
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 net/ssh failing to execute rake commands remotely

Hi I'm trying to use the ruby net/ssh gem (2.0.24) to connect to a remote server and run a rake task. I can run other simple tasks using the script outlined below, but rake is failing. This is my code Net::SSH.start("myremote_server", 'ubuntu',…
user141146
  • 3,285
  • 7
  • 38
  • 54
2
votes
1 answer

Having problems with net::ssh::multi can't require it! Ruby

So I've tried to install net::ssh::multi on mac using gems: gems install net-ssh-multi The installation went fine, however when I type: require 'net/ssh/multi' it says load error. I have no idea whats wrong with what I'm doing!
chutsu
  • 13,612
  • 19
  • 65
  • 86
2
votes
0 answers

Why does net-ssh-2.6.2 fail its own unit tests?

I've installed ruby (1.9.3) on both my Mac (running OSX 10.8.2) and PC (running Windows 7). I've installed (using "gem install ...") net-ssh, test-unit, mocha, and echoe. The install seems clean (the Mac complains about some Unicode junk in the…
Tom Stambaugh
  • 1,019
  • 13
  • 18
2
votes
3 answers

SUPPORTED_TYPE error when setting up a net-ssh connection

Has anyone out there seen this error before? I haven't been able to find any reference to SUPPORTED_TYPE in the source... irb(main):013:0> connection = Net::SSH.start('host', 'user', :password => 'password') NameError: uninitialized constant…
grumpasaurus
  • 732
  • 1
  • 6
  • 16
1
vote
3 answers

SSH connection with Ruby without username using `authorized_keys`

I have authenticated a server using authorized_keys push so I could run command ssh 192.168.1.101 from my system and could connect via server. Now, I tried with library , It didn't worked for me Net::SSH.start("192.168.1.209",username) do |ssh| …
Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
1
vote
6 answers

'no such file to load -- net/ssh' from rails Controller on Ubuntu

I have a very simple controller: require 'net/ssh' class MyController < ApplicationController def foo render :text => 'bar' end end But when I request http://server:3000/my/foo I get: MissingSourceFile in MyController#foo no such…
alex2k8
  • 42,496
  • 57
  • 170
  • 221
1
vote
0 answers

Unable to create file with correct permissions using Net::SSH library

I'm having troubles correctly setting file permissions using the Net::SSH library. Although I can correctly set the file's permissions after creating it, I need the file to have the correct permissions in the instance it's created. I'm connecting to…
acw
  • 1,093
  • 10
  • 14
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
2 answers

Marshaling Strings in Ruby

I'm encountering a bug using Capistrano. I've narrowed down the bug to literally this line of code: puts message Where "message" is a string that has come from a remove server via net-ssh. So I'm trying to create a single .rb file that reproduces…
Lelon
  • 905
  • 1
  • 8
  • 15
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:…