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

How to get exit status with Ruby's Net::SSH library?

I have a snippet of code, simply trying to execute a script on a remote server, in the event that it fails, I'd like to make a follow-up call, imagine this: require 'rubygems' require 'net/ssh' require 'etc' server =…
Lee Hambley
  • 6,270
  • 5
  • 49
  • 81
23
votes
3 answers

Generate SSH Keypairs (private/public) without ssh-keygen

I'm working on a Ruby/Rack application that needs to generate SSH keypairs. As much as I'd like to call ssh-keygen from the application, I can't because it's designed to run on Heroku and they don't support calling that command. I've been able to…
bensie
  • 5,373
  • 1
  • 31
  • 34
16
votes
2 answers

Ruby on rails - cannot load such file -- net/ssh

I've been struggling on this for a few days now.. When I try to call a method in a helper from a view to do ssh, it throws that error. "This error occurred while loading the following files: net/ssh" But when I copy the code into a test.rb file…
Guillaume Caillé
  • 393
  • 2
  • 6
  • 20
13
votes
2 answers

Cannot connect using keys with Ruby and net/ssh

I'm having trouble connecting via ssh from ruby using the 'net-ssh' gem, getting Net::SSH::AuthenticationFailed. The code is below require 'net/ssh' keys = ["path_to_private_key"] Net::SSH.start('host', 'user',:keys => keys, :verbose => :debug) do…
grant
  • 852
  • 1
  • 8
  • 21
11
votes
1 answer

Ruby SSH disable paging

Is there any way to disable or set the page-length of a ruby Net-SSH connection so we don't have to change the settings on the remote device? In Cisco routers we would use the parameters "terminal length 0" to accomplish this but on other servers…
Bulki
  • 734
  • 1
  • 10
  • 30
8
votes
3 answers

Error "non-absolute home" via Net:SSH

The code in question Net::SSH.start('server name', 'user') This returns "non-absolute home". The 'user' in fact does have a home directory. One suggested approach was to modify ~/.ssh/config with full paths to the IdentityFile. This did not…
Jadon
  • 155
  • 1
  • 5
7
votes
2 answers

Using Ruby and net-ssh, how do I authenticate using the key_data parameter with Net::SSH.start?

I've read the net-ssh documentation, and I am still perplexed. I can authenticate manually (using ssh -i ...), and also by placing the key in a file and using the :keys parameter. However, I dont want to use the :keys parameter, I want to use the…
zDan
  • 71
  • 1
  • 3
7
votes
6 answers

Can't install chef, gem version conflict with net-ssh net-ssh-multi net-ssh-gateway

Using rvm, and an empty gemset, I get this: $ gem install chef --no-ri --no-rdoc ERROR: While executing gem ... (Gem::DependencyError) Unable to resolve dependencies: chef requires net-ssh (~> 2.2.2); net-ssh-multi requires net-ssh (>= 2.6.5);…
Mojo
  • 2,687
  • 5
  • 30
  • 42
6
votes
2 answers

ruby net-ssh login shell

Is there any way i can get a login shell in ruby using net-ssh? Is that even possible? By login shell i mean the ones the source /etc/profile..
alexcepoi
  • 708
  • 1
  • 10
  • 19
6
votes
6 answers

Net::SSH sudo command hangs after entering password

I've been trying to write a small library using Thor to help assist me in quick creating new projects and sites. I wrote this small method: def ssh(cmd) Net::SSH.start( server_ip, user, :port => port) do |session| session.exec cmd …
joeellis
  • 2,745
  • 7
  • 28
  • 45
6
votes
3 answers

Could not find valid gem: certificate verify failed

I'm trying to establish an ssh tunnel to a remote server as described here: SSH from Heroku into remote server with Mysql Db But I'm hung up just simply trying to download the gems. I added: # file: Gemfile ... gem 'net-ssh-gateway', '~>…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217
6
votes
1 answer

Get Live logs in front end on rails application

Here in the rails 3.x app,I am using net::ssh and running some commands to remote pc.I would like to display the live logs to the user's browser.like,If two commands are running in net::ssh to execute i.e echo "Hello",echo "Bye" is passed then…
kanna
  • 366
  • 2
  • 19
6
votes
2 answers

Ruby NET::SCP containing Wildcard

I need to download a file daily from a client that I have SCP but not SSH access to. The file name will always be /outgoing/Extract/visit_[date]-[timestamp].dat.gz' For example yesterdays file was called visits_20130604-090003.dat.gz I can not rely…
Devin Stewart
  • 3,006
  • 1
  • 16
  • 22
6
votes
1 answer

How to net-ssh sudo su in Ruby

I'm trying to figure out how to a send chain of multiple net-ssh commands after a sudo su - #{su_user} in Ruby. My current code is below, and hangs with the sudo su command, even after the send_data "#{password}\n". Meanwhile, on the system, a…
SysTest RJR
  • 259
  • 4
  • 12
5
votes
2 answers

Ruby Net:SSH Control Master?

I currently have a Ruby (Rails) application that needs to make a lot of short SSH connections. This works fine using the Ruby Net::SSH library, except that the app has to log in and negotiate keys every time I want to make a command, which is too…
Harry
  • 4,660
  • 7
  • 37
  • 65
1
2 3
13 14