net-ssh

'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 file to load -- net/ssh The gem is installed > gem list net-ssh *** LOCAL GEMS *** ...

What to do when Net-SSH complains about exec! method missing?

This is driving me crazy. I run into this every now and then on a new ubuntu/debian server. Basically I can't do a exec! through net-ssh. Note, that I can require 'net/ssh' perfectly fine. sample code require 'rubygems' require 'net/ssh' Net::SSH.start('my.random.box', 'myuser', :forward_agent => "true") do |ssh| #output = ssh.exec...

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! ...

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 'net/ssh' require 'net/ssh/multi' Net::SSH::Multi.start do |session| # Connect to remot...

gltail "Missing gem net-ssh"

I'm attempting to get gltail set up on my local system to monitor logs remotely. I've got all the dependencies installed, but when I go to run gltail ... ./gl_tail configfile ../config.yaml I get this output: Missing gem net-ssh. Ubuntu: sudo gem install -y net-ssh -r .. which I've done a number of times. Here is the output: de...

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? ...

Local installation of ruby / rubygems with no root access

Hi, I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine. So what I did was: Download ruby source, configure (w...

Ruby net-ssh: How to authenticate with pubkey using a gateway

Hello, I am trying to run a script in several machines I have at work, to gather some information about them, such as which OS they're running, what services run on them, some configurations, etc. I have a machine on which I log before ssh-ing to any of the other machines, because of the public key setup it has. From there, I can ssh in...

Respond to a SSH prompt before first command with ruby and Net::SSH

Hello, I'm trying to connect, using Net::SSH, to a server that immediately after login executes a script that requires input from user. The user has to enter "1" or "2" and will receive some data via in the terminal afterwards. My problem is that, although I am able to connect, I can not figure out a way to send "1\n" to the server and...

Can i Use the value of a variable from within a ruby script inside ssh.exec()

If i have a # {} , like #{results}, in the snippet below: results = Array.new                                   f = open("/Users/kahmed/messages", "r")                                   f.each_line do |line|                                        results << "#{$.} #{line}" if line =~ /NFE/                                       put #{r...

Within a ruby script how can i ignore HostKeyMismatch, and still login via Net::SSH.start()

I tried Net::SSH.start( value_hosts, USER, :password => PASS , :forward_agent => true , :paranoid => false) do|ssh, err| but :paranoid option does not seem to work ...

Executing Password Change over Ruby Net-SSH

Hi all, I am looking to execute a password change over Net-ssh and this code seems to hang: Net::SSH.start(server_ip, "user", :verbose => :debug ) do |session| session.process.popen3("ls") do |input, output, error| ["old_pass","test", "test"].each do |x| input.puts x end end end I know the connection works b...

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

Hello, 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 'rubygems' require 'net/ssh' Net::SSH.start(remote_host, user_name, :password => password) do...

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

Hello, 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 directories in script.? Thanks. ...

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 now connectivity to these end-points is becoming a pain, because I need to explain to my u...

Catching an error in Ruby's net-ssh

I'm using net-ssh to iterate over a couple of hosts in a loop. This bit of code will throw an error if the username entered is incorrect. Net::SSH.start(host, user) do |ssh| out = ssh.exec!(exec) puts out ...

Using Net SSH to execute commands with sudo

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 end end to just assist me in running quick commands on remote servers when needed. The proble...

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 = 'localhost' Net::SSH.start(server, Etc.getlogin) do |ssh| puts (ssh.exec("true") ? 'Exit Success' : "Exit Failure") ...

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

:paranoid => false in the Net::SSH.start() does not seem to work ...

Net::SSH connection fails from inside resque job

I have an app that sets creates EC2 instances - I have a resque task that will configure the server (via ssh) once it's up and running: Net::SSH.start(server.dns_name, 'root', :keys => ['~/.ssh/testkey.pem'], :paranoid => false, :verbose => :debug) do |ssh| result = ssh.exec!("ls -l") puts result end I get an...