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 ***
...
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...
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!
...
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...
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...
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?
...
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...
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...
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...
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...
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
...
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...
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...
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.
...
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...
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 ...
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...
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")
...
:paranoid => false in the Net::SSH.start() does not seem to work
...
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...