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
4
votes
3 answers

How to properly implement Net::SSH port forwards

I have been trying to get port forwarding to work correctly with Net::SSH. From what I understand I need to fork out the Net::SSH session if I want to be able to use it from the same Ruby program so that the event handling loop can actually process…
HerbCSO
  • 762
  • 1
  • 8
  • 20
4
votes
3 answers

Net::SSH::Multi using the session.exec, how do you get the output straight away? Ruby

So I've been trying to use the Net::SSH::Multi to login to multiple machines using the via SSH, and then executing shell commands on the remote machines with session.exec("some_command"). The Code: #!/usr/bin/ruby require 'rubygems' require…
chutsu
  • 13,612
  • 19
  • 65
  • 86
3
votes
2 answers

How do I run Net::SSH and AMQP in the same EventMachine reactor?

Some background: Gerrit exposes an event stream through SSH. It's a cute trick, but I need to convert those events into AMQP messages. I've tried to do this with ruby-amqp and Net::SSH but, well, it doesn't seem as if the AMQP sub-component is even…
troutwine
  • 3,721
  • 3
  • 28
  • 62
3
votes
4 answers

How to SSH into a server and then SFTP from there to another server?

Here's the situation: I have SSH access to ServerA I have SFTP access to ServerB, but only from ServerA I want to use Ruby to SSH into ServerA, then SFTP files from ServerB to ServerA. I can connect to ServerA using the documentation from…
jemminger
  • 5,133
  • 4
  • 26
  • 47
3
votes
2 answers

How to copy files using Net::SSH in Ruby?

So far as I can tell I need to use both Net::SCP and Net::SSH if I want to copy a file to a remote host and then manipulate it from the command line. It would be nice to set up one SSH session, do the copy and then use the same connection to unpack…
Russell Fulton
  • 570
  • 4
  • 17
3
votes
1 answer

ConnectionTimeout Error When Using net-ssh With Options that Work with ssh Command?

I'm trying to use the net-ssh documentation to connect to a remote server. I'm using the following options: :username :port :keys :host with values set equal to the values of the Host that I have configured in my ~/.ssh/config file that I use for…
gr1zzly be4r
  • 2,072
  • 1
  • 18
  • 33
3
votes
1 answer

Dynamic SSH tunnel using ruby

I would like to transform this unix command into a ruby script ssh -2 -f -c blowfish -N -C user@ip -D 8080 This is to enable all my web traffic to be encrypted in a ssh tunnel. I tried with net-ssh library without success. EDIT: Here is what I…
Arkan
  • 6,196
  • 3
  • 38
  • 54
3
votes
1 answer

How do I process a URL in ruby to extract the component parts (scheme, username, password, host, etc)?

I'm trying create a program using ruby (and Net::SSH) to connect to servers and perform some tasks. The details of the server are to be provided as something like: ssh://user:pass@host:port (for a host that does not yet have SSH…
Luke Chadwick
  • 1,648
  • 14
  • 24
3
votes
1 answer

ssh proxy script runs in ruby but not in jruby

I have a ruby script that uses the net::ssh gem. Its a simple script to tunnel through a jump-off server to a destination box. The box is only visible to the jump-off server. Here is the script: require 'net/ssh/proxy/command' require…
amadain
  • 2,724
  • 4
  • 37
  • 58
3
votes
3 answers

Browser based (free to use) SSH

I have a commercial product that allows users to connect to various SSH end-points. Currently these users are forced to download and use Putty... Seems pretty straightforward, except that my SSH end-points require RSA/Private Key authentication. So…
LoneRanger
  • 1,909
  • 2
  • 13
  • 13
3
votes
1 answer

How to create a file in remote host along with the creation of directory using ssh

I have a file say /a/b/c/file in my host. I want to create a file on remote host in directory say dest. Now the question is, how do I create a file in remote host as /dest/a/b/c/d/file using perl script and using ssh. Any idea how do I create…
Anu
  • 525
  • 1
  • 6
  • 18
3
votes
1 answer

Local-to-remote port forwarding using Ruby/Net::SSH for remote db connection

I'm accessing a remote database using a local-to-remote port forwarding from my windows box. It works like a charm using putty for port forwarding but it fails when I try to forward using Ruby/Net::SSH. Here is my code snippet: require…
nakhli
  • 4,009
  • 5
  • 38
  • 61
3
votes
3 answers

Table files transfered between servers flags table as crashed

Work has a web site that uses large data sets, load balanced between two MySQL 5.6.16-64.2 servers using MyISAM, running on Linux (2.6.32-358.el6.x86_64 GNU/Linux.) This data is being updated hourly from a text based file set that is received from a…
Quintium
  • 499
  • 5
  • 22
3
votes
1 answer

Capistrano : NoMethodError: undefined method `recv' for #

This error in Capistrano (> 3) prevents me from deploying my Rails application. My Capistrano config works fine on another environment. DEBUG [6c7d7bed] Command: if test ! -d /opt/my_app/releases/20140429175529; then echo "Directory does not exist…
Such
  • 910
  • 1
  • 9
  • 20
3
votes
0 answers

Enable X11 Forwarding with Net::SSH in Ruby

For some actions, I need to ssh with ssh -X user@host. Is it possible for Ruby's Net::SSH to use this (with emphasis on the -X)? Net::SSH.start('host', 'user', password: 'password') do |ssh| # Do work end I'm not currently seeing any options to…
ardavis
  • 9,842
  • 12
  • 58
  • 112
1 2
3
13 14