211 questions
0
votes
0
answers
63
views
Ruby Net::SSH Freeze when using "rails console" command over SSH
I'm building a web based Terminal that runs against other server by SSH. I'm using Xterm.js for the UI and Net::SSH for the backend. The communication between the website and the backend is inside an ...
2
votes
0
answers
91
views
Ruby Net::SSH.start() is failing with authentication issues but the key being used is fine when sshing outside of Ruby
I'm trying to ssh into a machine as part of a Ruby test and run a command on the machine. To do this, I'm using Ruby's Net:SSH library. A simple version of the script I'm using looks like:
require '...
0
votes
1
answer
288
views
Ruby's Net::SSH is limited to 3 authentication tries while OpenSSH client is not
I'm having a really weird problem where when I connect to an SSH server (that has a pretty standard default configuration, including a default MaxAuthTries of 6) using Net::SSH, the connection fails ...
0
votes
0
answers
56
views
Running SSH commands in Ruby with interactive login prompt
I want to execute commands on a remote target (via Ruby SSH). The login should be done with an interactive login prompt. This is what I got so far.
print('login: ')
user = $stdin.gets.chomp
Net::SSH....
1
vote
0
answers
671
views
could not settle on kex algorithm - SFTP connection failed
Tried to connect SFTP server using RSA private key with a ruby script. It's not connecting. But it's working using Filezilla.
Code example:
require 'net/sftp'
sftp = Net::SFTP.start('hostname', 'user'...
2
votes
1
answer
3k
views
Ruby Net/SSH 7.0.1 - Ubuntu 22 / OpenSSL 3 issue
I'm using Ubuntu 22 and OpenSSL 3
Ruby's Net/SSH is not working any longer as soon as I'm trying to connect using private keys.
Net::SSH.start X.X.X.X, "root"
/.rvm/gems/ruby-3.1.2/gems/net-...
0
votes
1
answer
50
views
How to check SSH connection with Rails 5.2 and Net::SSH.start
I need to check whether the SSH connection to a remote server I use is correct or not.
I issue the following test:
begin
session = Net::SSH.start(uri, login, password: password)
session....
0
votes
2
answers
268
views
Remote execution of SSH command hangs in ruby using Net::SSH for a particular command
I found a similar question here, but the answer in such a question didn't work for me.
I am trying to connect the remote ssh server via ruby using Net::SSH.
It is working fine for me for all the ...
1
vote
1
answer
343
views
After restarting the server instance, Capistrano throws the error that Authentication failed for user Net::SSH::AuthenticationFailed
It is our maintenance project. We have got the private key(id_rsa.txt) of production server to sign-in from the client.
If we want to deploy the application, we just add the private key file to my ...
0
votes
1
answer
222
views
Ruby net/ssh is not running bash commands in background
I am having a hard time running bash commands in background from a Ruby script.
For this question, I am using a simplified example.
This is how commands are working as expected when I run them from ...
1
vote
1
answer
753
views
Capistrano deploy used to work but now getting authentication failure
I know this probably looks like a repeat of this question, but believe me, this is slightly different.
I have been using Capistrano to deploy a Rails app for several years now, but as of last week I ...
0
votes
1
answer
2k
views
Errno::ENOTTY Inappropriate ioctl for device when connecting to a remote server through Net::SSH on SuSe (with Ruby on Rails 5.2.4)
My Ruby on Rails application remotely starts some scripts on a distant SuSe server (SUSE Linux Enterprise Server 15 SP2). It relies on the net-ssh gem which is declared in the Gemfile: gem 'net-ssh'.
...
1
vote
1
answer
157
views
tput: No value for $TERM and no -T specified while using Ruby Net:SSH
I'm using the Ruby Net:SSH lib to do a ssh connection to a remote PC and then execute a remote cmd.
When I start my SSH connection I have no issue but sometimes, not everywhere, when I use the exec! I ...
1
vote
0
answers
336
views
Ruby ocra LoadError Exception - net/ssh
So i am trying to build a standalone .exe from my ruby script with ocra:
#test.rb
require "rubygems"
require "net/ssh"
$hostname = "1.1.1.1"
$username = "root"
...
2
votes
2
answers
83
views
Are there any security risks to using "remember_host!" when getting a HostKeyMismatch exception using net-ssh ruby gem?
I have seen people who suggest using a code chunk like this:
begin
Net::SSH::start
rescue Net::SSH::HostKeyError => e
e.remember_host!
retry
end
As the exception type suggests, it's for ...
0
votes
1
answer
1k
views
How to properly close a Net::SSH connection?
Many articles demonstrate Net::SSH by using a block, such as the following:
Net::SSH.start("host", "user") do |ssh|
ssh.exec! "cp /some/file /another/location"
...
0
votes
1
answer
1k
views
After uploading a file using Net::Sftp, the file disappears sometimes
I use net-sftp gem for uploading file to remote server.
Net::SFTP.start(host, user, port: port, key_data: [decoded_key], keys: [], keys_only: true, logger: logger, verbose: :debug) do |sftp|
sftp....
0
votes
0
answers
116
views
Remote server doesn't accept password, ruby script 'net/ssh'
I connect using ruby to the remote, pass the command, but channel.send_data ("passwd\n") dont work , I cant catch in than the reason. The password doesn't pass.
require 'rubygems'
require 'net/...
0
votes
1
answer
428
views
Rails RSpec net-ssh mock return of second ssh request
I'm working on a web application that frequently access simulation data on a remote server. I want to create test for errors handling that might happen during these request.
The problem I currently ...
0
votes
1
answer
2k
views
How to proxy net-sftp?
I'm using net-sftp which relies on the net-ssh gem.
I'm trying to connect to a remote log service via SFTP, and it requires IP whitelisting. All my current servers have dynamic IPs.
I'm trying to ...
0
votes
1
answer
47
views
Running the workflows thru Ruby and Test gets passed but the workflows does not trigger
I am trying to run the informatica workflows thru ruby. Using the Net-ssh gem. When i run my test it gets passed but my jobs are not triggered when i check the logs they are not creating.
Below is my ...
1
vote
1
answer
4k
views
Connection problem with phpseclib Net SSH2
I am having problems with phpseclib Net SSH2 libraries, the connection to the server is impossible, I tried to find a solution but I can not find it.
Notice: Error reading from socket in C:\wamp64\...
1
vote
2
answers
440
views
Losing environment variable set via ssh execute. Ruby & net-ssh
I would like to set Linux environment variables in net-ssh start and use them further down in my code. But I am losing the scope of the variables. Can you please advise how that can be achieved.
I ...
0
votes
1
answer
149
views
How do I configure net-ssh so I can fetch data using rest-client through an ssh tunnel?
We have an elasticsearch setup that is only available from a jump box. I want to set up an ssh tunnel so I can query from my laptop or a Docker container.
When I run ssh, either directly or via '...
0
votes
2
answers
1k
views
Create a Telnet connection via SSH using Ruby
I am having a slight issue. First and foremost, I had never written a single line of Ruby until being given this task so it is somewhat outwith my remit and comfort zone. This may well be a stupid ...
4
votes
1
answer
5k
views
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.
...
0
votes
3
answers
341
views
Ruby Net::SSH reuse session
I have a few methods doing this:
def method_a
Net::SSH.start(...) do |ssh|
end
end
def method_b
Net::SSH.start(...) do |ssh|
end
end
def method_c
Net::SSH.start(...) do |ssh|
...
3
votes
2
answers
2k
views
How to copy files using Net::SSH in Ruby?
So far as I can tell I need to use both Net::SCP and Net::SSH if I want to copy a file to a remote host and then manipulate it from the command line.
It would be nice to set up one SSH session, do ...
2
votes
1
answer
798
views
Interactive SSH session using Net::SSH or creating a STDIN Socket
This is not a duplicate of How to SSH interactive Session or Net::SSH interactive terminal scripting. How? or Ruby net-ssh interactive response/reply
I'm trying to write an interactive SSH client ...
0
votes
0
answers
102
views
How can I SSH after establishing a connection with ruby net/ssh gem
I have 2 systems I work with that are daisy chained. System A is what I have to connect to initially, then I ssh into system B to run commands to view status of services and other things. I work doing ...
0
votes
0
answers
185
views
Ruby Net::SCP multiple uploads in parallel
I would like to upload multiple files to a remote machine in parallel. This is what I have tried so far based on the documentation
Net::SCP.start(ip, user) do |scp|
channels = []
dst = '...
2
votes
2
answers
745
views
.exe crated using Par::Packer with script containing Net::SSH2 is not working
Am using Net::SSH2 module in my Perl script and trying to make an executable (.exe for windows) using Par::Packer. The script need to ssh to a linux box from a windows box using public keys and don't ...
4
votes
2
answers
2k
views
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....
2
votes
1
answer
1k
views
Why key type ecdsa-sha2-nistp256 is unsupported?
I'am trying to use ruby gem net-ssh and receive the error described bellow
jruby-9.1.15.0 :001 > require "net/ssh"
=> true
jruby-9.1.15.0 :002 > Net::SSH.start('myhost.dev', 'username' ...
0
votes
1
answer
351
views
How to read text from file into an array in ruby
Is there a way to treat the HOST, USER, PASS varibales in the net - ssh gem as an array and have multiple values for them?
I currently have an outside text file with the HOST, USER AND PASS values, ...
0
votes
0
answers
2k
views
cap aborted! SSHKit::Runner::ExecuteError: and Net::SSH::AuthenticationFailed for user
I have been trying to deploy a Rails app using Capistrano but when I run cap production deploy I get:
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception ...
3
votes
1
answer
4k
views
ConnectionTimeout Error When Using net-ssh With Options that Work with ssh Command?
I'm trying to use the net-ssh documentation to connect to a remote server. I'm using the following options:
:username
:port
:keys
:host
with values set equal to the values of the Host that I have ...
1
vote
0
answers
37
views
How can I have Rye return invalid commands in ruby
Here is the code I am using:
require 'rye'
r = Rye::Box.new("ip_of_server", :user => "username_of_server", :password => "password_of_server", :safe => false)
r.execute("which testing")
I ...
1
vote
0
answers
774
views
Net::SSH performance, why is it so slow?
I have an automated test case in Ruby (using a framework I'm building see github), that is doing like around 15-20 SSH connections to servers under test collecting various data and logs.
Problem is ...
1
vote
0
answers
53
views
Parsing file names using ruby Net::SSH
Working on automating a task for my job.
Issue: We have a rather large stack of git repos hosted on a private git server at our main office. I work at a remote location.
Goal: I need to clone many (...
1
vote
1
answer
884
views
Net::SSH.start Timeout connecting to Vagrant host in Ruby
I have a vagrant VM running.
vagrant init centos/7
Generates the minimal Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
end
vagrant ssh-config reports the following:
...
1
vote
1
answer
475
views
Ruby Net/SSH exec - get pid of remote process
I am launching a nohup remote script with Ruby Net/SSH.
Net::SSH.start(ip_address, user, options) do |ssh|
script = File.join(remote_path, 'run_case.py')
cmd = "nohup python #{script} #{args} &...
0
votes
1
answer
85
views
Threaded output not displayed when run from command (works from irb)
I decided to rewrite a ruby script I did as a gem/module with an executable component. The original works fine, but as a gem it is easier to maintain/install with all dependencies.
The command takes ...
1
vote
0
answers
564
views
How to do open_channel in python paramiko?
How to convert this ruby piece to python?
Net::SSH.start(machine, "ubuntu", {:keys => [ssh_key]}) do |ssh|
ssh.open_channel do |ch|
sent_cmd = false
ch.request_pty do |ch,success|
...
1
vote
1
answer
481
views
How to not add host key to known host file when logging in using Net::SSH.start()
I have three bastion instances, and Capistrano connects using SSH to the bastions and executes code.
These are my SSH options for Capistrano:
set :ssh_options, forward_agent: true, auth_methods: %w(...
1
vote
0
answers
58
views
Reading stdout of Linux instance with Ruby gem net-ssh 4.1.0
I am trying to write a script in Ruby with net-ssh. I've got it talking to my Linux ec2 instance with a basic login and execution of "ls":
Net::SSH.start('host', 'user', :password => "password") ...
0
votes
2
answers
1k
views
PHP Net_SSH2 cannot conect
I am trying to use Net_SSH2 class for login in ssh server and i get error:
Notice: No compatible server to client encryption algorithms found in /var/www/html/includes/classes/Net/SSH2.php on line ...
-1
votes
1
answer
242
views
Using Net::SSH to login to shell and get stateful output
I was reading the documentation (which is pretty outdated). Net-ssh does not have .shell method anymore? how can i achieve signing into the shell, run command and get stdout until its done?
Can ...
1
vote
2
answers
2k
views
Authentication failed Error when deploying to AWS EC2 AMI with Capistrano
I am following this tutorial:
https://www.sitepoint.com/deploy-your-rails-app-to-aws/
The app is fully created and running in development (including the database).
Keys have been added to GIT and ...
0
votes
1
answer
189
views
Make Net::SSH and Net::SSH::Telnet ask for username
Currently in Ruby's Net::SSH and Net::SSH::Telnet library if I run
shell = Net::SSH::Telnet.new("Dump_log" => "/dev/stdout", "Host" => "1.1.1.1")
or
shell = Net::SSH.start("1.1.1.1")
It ...