From sd, 1 Year ago, written in Plain Text.
  1. ========================== MY SCRIPT ========================
  2.  
  3. root@nitin-VirtualBox:~# cat test_key.rb
  4. #!/usr/bin/env ruby
  5. require 'rubygems'
  6. require 'net/ssh'
  7. require 'logger'
  8. HOST = '10.239.44.55'
  9.  
  10. Net::SSH.start(
  11.   '10.239.44.55', 'root',
  12.   :host_key => "ssh-rsa",
  13.   :encryption => "aes128-cbc",
  14.   :keys => [ "~/.ssh/id_rsa.pub" ],
  15.   :compression => "zlib"
  16.  ) do |ssh|
  17. result = ssh.exec!('uname -r;cat /etc/redhat-release')
  18. puts result
  19. end
  20.  
  21.  
  22. ======================== ERROR =============================
  23.  
  24. root@nitin-VirtualBox:~# ./test_key.rb
  25. Traceback (most recent call last):
  26.         13: from ./test_key.rb:7:in `<main>'
  27.         12: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh.rb:242:in `start'
  28.         11: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh.rb:242:in `new'
  29.         10: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:90:in `initialize'
  30.          9: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:223:in `wait'
  31.          8: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:223:in `loop'
  32.          7: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:225:in `block in wait'
  33.          6: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:190:in `poll_message'
  34.          5: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:190:in `loop'
  35.          4: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/session.rb:210:in `block in poll_message'
  36.          3: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/algorithms.rb:150:in `accept_kexinit'
  37.          2: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/algorithms.rb:210:in `proceed!'
  38.          1: from /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/algorithms.rb:335:in `negotiate_algorithms'
  39. /usr/local/rvm/gems/ruby-2.5.1/gems/net-ssh-5.0.2/lib/net/ssh/transport/algorithms.rb:354:in `negotiate': could not settle on compression_client algorithm (Net::SSH::Exception)
captcha