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

net-ssh and remote environment

I want to execute some remote command on my server using net-ssh library. I have the following example: Net::SSH::start(host, user, options = {:keys => '~/.ssh/id_rsa'}) do |ssh| puts ssh.exec!("echo $PATH") ssh.loop end The result is:…
Arkan
  • 6,196
  • 3
  • 38
  • 54
5
votes
3 answers

Using the ruby gem net-ssh-multi to execute a sudo command on multiple servers at once

In a previous question I figured out how to start a password-authenticated ssh sessions on multiple servers to run a single command. Now I need to be able to execute a "sudo" command. The problem is, that net-ssh-multi does not allocate a pseudo…
Dmitri
  • 2,658
  • 2
  • 25
  • 41
5
votes
5 answers

installing Net/SSH/Perl.pm

I am fairly new to scripting with perl. I am trying to ssh into a server and perform some commands. I have to provide a username and password. When trying to run the script that i have so far (code listed below). I get the following error. I am…
prolink007
  • 33,872
  • 24
  • 117
  • 185
5
votes
1 answer

Rails + Delayed jobs: SSH connections pool

Current situation: I have a rails app with N delayed job workers. Whenever I want to send an SSH request to some machine, I create a task for the worker. Worker performs something like: Net:SSH.start(hostname, username, :password => pass) do |ssh| …
Andrey Sereda
  • 204
  • 2
  • 5
5
votes
1 answer

Ruby net-ssh wirth proxy command causes freeze

I would like to connect to a remote computer via another using ruby. This scheme is the following : Local -> proxy -> remote I have this code which is doing the work for a direct access : require 'net/ssh' Net::SSH.start(remote_host, remote_user)…
j.flajo
  • 113
  • 1
  • 5
5
votes
1 answer

How do I send SIGINT to a process startet in a Net::SSH session?

I use Net::SSHv2 to connect to a server and start a script on that server. So far it is working, but I want to interrupt the script when it is running for over 10 minutes or the output file gets too big. After receiving the interrupt the script will…
Kurt
  • 113
  • 6
5
votes
4 answers

Net-ssh timeout for execution?

In my application I want to terminate the exec! command of my SSH connection after a specified amount of time. I found the :timeout for the Net::SSH.start command but following the documentation this is only for the initial connection. Is there…
Sebastian Müller
  • 5,471
  • 13
  • 51
  • 79
4
votes
1 answer

Net-SSH/Capistrano problem: "Could not parse PKey: no start line"

For years I've been deploying my Rails 3.2.13 app successfully using Capistrano. But just today I ran into the dreaded ArgumentError: Could not parse PKey: no start line when connecting to the server. From other posts I gather this is actually an…
Jonathan
  • 1,075
  • 2
  • 10
  • 18
4
votes
2 answers

Ruby script Net::SSH::HostKeyMismatch but ssh works

I can ssh into a remote host on my aws network but using net/ssh fails in a ruby script. my gem is net-ssh(4.2.0) on Ubuntu 16.04. It doesn't prompt for a passphrase even with non_interactive => false. error: Authentication failed for user…
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
4
votes
2 answers

Need to ignore HostKeyMismatch when logging in using Net::SSH.start()

:paranoid => false in the Net::SSH.start() does not seem to work
DVK
  • 126,886
  • 32
  • 213
  • 327
4
votes
4 answers

How to install capistrano v2.13.5 with ruby 1.8.7?

I am using ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin14]. When I try to install the capistrano gem I get the following error: sudo gem install capistrano -v2.13.5 ERROR: Error installing capistrano: net-ssh requires Ruby version >=…
Fabrizio Fortino
  • 1,479
  • 1
  • 14
  • 22
4
votes
2 answers

Openshift and net-ssh incompatibility? (2.9.3-beta1 vs 2.9.2)

by searching to access my Postgres DB on Openshift, i'm currently facing problem using net-ssh. At this step - note that the installed Ruby version is 2.2.0 and net-ssh is 2.9.3-beta1 To be able to access the DB from my local DB IDE, i need to…
miniflauw
  • 55
  • 5
4
votes
1 answer

Ruby SFTP—delete directory

I would like to delete a directory using sftp with ruby. Currently I am trying this method (rmdir) from the Net-sftp library of ruby. Here is my code: uri = URI(url) Net::SFTP.start(uri.host, uri.user, :password => uri.password) do |sftp| …
philipp
  • 15,947
  • 15
  • 61
  • 106
4
votes
1 answer

Localtunnel gem / Net::SSH not working

As per the instructions at http://progrium.com/localtunnel/ and elsewhere: gem install localtunnel localtunnel -k ~/.ssh/id_rsa.pub 3000 I get the error: /path/to/gems/net-ssh-2.6.7/lib/net/ssh/transport/packet_stream.rb:103:in `block in…
4
votes
2 answers

Net/SSH.start doesn't raise an exception if it fails

I'm using Net::SSH to connect to another server. It works fine, but I want to be able to deal with situations where it can't connect. Documentation for the method mentions nothing about exceptions, and as far as I can see it doesn't raise any. In…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
1
2
3
13 14