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
0
votes
1 answer

Net::SCP password prompt

Net::SCP requires password even though it is provided. Host machine has authorized_keys.pub and id_rsa.pub from user's machine. User has id_rsa and id_rsa.pub I also have tried to enter the ssh_key which was the preferred way of doing so from the…
0
votes
1 answer

Duplicate response from Ruby - Telnet connection?

I'm trying to implement a solution to enter an API command and transfer it by Telnet to a hardware device and capture the response. I've tried two different Telnet implementations, one with Net/SSH and the other with the Greenletters gem and I can…
Nick L
  • 1
  • 3
0
votes
1 answer

Ruby returns syntax errors when referencing Net::SSH

I've the following installed: Ruby version 1.8.7 Net::SSH 2.10.0 I get the following error when I run my script: /usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/session.rb:4:in `require':…
0
votes
1 answer

Problems with perl Net::SSH2::channel

I'm having a Problem with Net::SSH2::Channel. I'm Working on Oracle LINUX 2.6.39-400.214.5.el6uek.x86_64, using perl-5.10.1-136.el6.x86_64. The remote server runs Debian 3.2.60-1+deb7u3 x86_64. The perl code is going to be used as a function inside…
Ralf
  • 1
  • 2
0
votes
1 answer

Ruby use local defined variable to a remote server connection

Here is what i want to do: VAR_NAME="lala123" Net::SSH.start( HOST, USER ) do |ssh| create_file = ssh.exec!('sudo mkdir /path/to/; \ sudo touch /path/to/file; \ sudo echo #{VAR_NAME} >…
0
votes
0 answers

Windows 7 + ChefDK | kitchen converge failing with Net::SSH::Disconnect

From regular windows 7 cmd I have generated a boilerplate chef cookbook with chef generate cookbook test. I have vagrant, virtualbox and my local .box file loaded and can see it when executing vagrant box list. When trying to run kitchen converge it…
Jacques Betancourt
  • 2,652
  • 3
  • 18
  • 19
0
votes
1 answer

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/                           …
kamal
  • 9,637
  • 30
  • 101
  • 168
0
votes
1 answer

Using Net::SSH in an `initialize` block does not work

I want to connect to a remote server and run some commands there. For that I am writing the following Ruby script and it works fine. @hostname = "SERVER_NAME" @username = "user" @password = "pass" @cmd = "ls -alt" begin @ssh =…
itsh
  • 1,063
  • 3
  • 14
  • 28
0
votes
0 answers

Change directory in server is not changing when trying from client - ruby

This is small part of my code. If this is not sufficient, i will the post full code. I have few commands to execute in the server and everything works fine except changing directory cd command using require 'net/ssh'. I have tried with both cd and…
Rahul Dess
  • 2,397
  • 2
  • 21
  • 42
0
votes
1 answer

How do I switch user in Linux using ruby and net/ssh?

Using below function I can connect to my Linux machine. But few commands need root permission to execute and direct root login is disabled. Also, the user cannot sudo. require 'net/ssh' def sshutm(host,un,pwd,cmd) Net::SSH.start( host, un,…
Aniket
  • 67
  • 1
  • 5
0
votes
1 answer

Ruby net/ssh script not closing

I have a ruby script where I'm using net/ssh to ssh into a server, sudo -s, su - user, run a script and answer the questions to that script. So far I'm able to do everything, login, do all of the su/sudo stuff, run the script and answer its…
Tony D
  • 49
  • 1
  • 7
0
votes
0 answers

net_ssh on production returns 'Authentication Failed' using public keys

I am trying to execute couple of commands on remote server and as authentication method, I am using public keys. Public keys are configured properly on server and I can connect to it without system prompting me for password like this: ssh…
Vitali
  • 690
  • 9
  • 29
0
votes
2 answers

Delete everything other than file + linked file across multiple servers (NET::SSH::MULTI)

I've got a couple of thousand images that are saved as logs that need to be deleted. To avoid the limit of rm and to do this across multiple servers, I used the following code Net::SSH::Multi.start(:on_error => :ignore) do |session| # define…
Kishe
  • 9
  • 3
0
votes
1 answer

SSH Expect skipping "more" prompt on router

after testing several modules for sending SSH commands with PERL, my choice is for the Net::SSH::Expect module (able to send mutiple commands for a unique connection) I am still testing some functions on it, here's my code : use…
Gui O
  • 363
  • 4
  • 8
  • 22
0
votes
0 answers

net-ssh forward port within a port-forward

So im trying to forward a port in an already forwarded session. here's the code: require 'net/ssh' Net::SSH.start( '1.2.3.4', 'username', :host_key => "ssh-rsa", :keys => [ "/Users/awesomesauce/.ssh/coolness.pem" ], ) do |session| …
Nicholas Terry
  • 1,812
  • 24
  • 40