Skip to content

Instantly share code, notes, and snippets.

@base10
Created October 15, 2013 15:13
Show Gist options
  • Save base10/6993152 to your computer and use it in GitHub Desktop.
Save base10/6993152 to your computer and use it in GitHub Desktop.
Ruby Friends, I'm having some trouble with Net::SSH on a machine connecting to a local virtual machine, created through veewee. When veewee attempts to connect to the VM it just created, it fails with an authentication error. I've reduced it to Net::SSH as the issue. I've spun up a virtual machine through veewee on two machines (Ruby 2.0.0 on bo…
D, [2013-10-10T10:17:22.970863 #12659] DEBUG -- net.ssh.transport.session[3fdf324ca274]: establishing connection to 127.0.0.1:7222
D, [2013-10-10T10:17:22.971295 #12659] DEBUG -- net.ssh.transport.session[3fdf324ca274]: connection established
I, [2013-10-10T10:17:22.971369 #12659] INFO -- net.ssh.transport.server_version[3fdf324cf634]: negotiating protocol version
D, [2013-10-10T10:17:22.975480 #12659] DEBUG -- net.ssh.transport.server_version[3fdf324cf634]: remote is `SSH-2.0-OpenSSH_5.3'
D, [2013-10-10T10:17:22.975552 #12659] DEBUG -- net.ssh.transport.server_version[3fdf324cf634]: local is `SSH-2.0-Ruby/Net::SSH_2.7.0 x86_64-darwin12.4.0'
D, [2013-10-10T10:17:22.977023 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 784 bytes
D, [2013-10-10T10:17:22.977121 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 0 type 20 len 780
I, [2013-10-10T10:17:22.977179 #12659] INFO -- net.ssh.transport.algorithms[3fdf324cea40]: got KEXINIT from server
I, [2013-10-10T10:17:22.977275 #12659] INFO -- net.ssh.transport.algorithms[3fdf324cea40]: sending KEXINIT
D, [2013-10-10T10:17:22.977393 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 0 type 20 len 1620
D, [2013-10-10T10:17:22.977448 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 1624 bytes
I, [2013-10-10T10:17:22.977475 #12659] INFO -- net.ssh.transport.algorithms[3fdf324cea40]: negotiating algorithms
D, [2013-10-10T10:17:22.977555 #12659] DEBUG -- net.ssh.transport.algorithms[3fdf324cea40]: negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: aes128-cbc
* encryption_client: aes128-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2013-10-10T10:17:22.977579 #12659] DEBUG -- net.ssh.transport.algorithms[3fdf324cea40]: exchanging keys
D, [2013-10-10T10:17:22.977717 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 1 type 34 len 20
D, [2013-10-10T10:17:22.977762 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 24 bytes
D, [2013-10-10T10:17:22.978582 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 152 bytes
D, [2013-10-10T10:17:22.978643 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 1 type 31 len 148
D, [2013-10-10T10:17:22.979832 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 2 type 32 len 140
D, [2013-10-10T10:17:22.979885 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 144 bytes
D, [2013-10-10T10:17:22.982236 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 720 bytes
D, [2013-10-10T10:17:22.982302 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 2 type 33 len 700
D, [2013-10-10T10:17:22.983199 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 3 type 21 len 20
D, [2013-10-10T10:17:22.983249 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 24 bytes
D, [2013-10-10T10:17:22.983296 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 3 type 21 len 12
D, [2013-10-10T10:17:22.983496 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: beginning authentication of `veewee'
D, [2013-10-10T10:17:22.983573 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 4 type 5 len 28
D, [2013-10-10T10:17:22.983619 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 52 bytes
D, [2013-10-10T10:17:22.983993 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 52 bytes
D, [2013-10-10T10:17:22.984061 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 4 type 6 len 28
D, [2013-10-10T10:17:22.984149 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: trying none
D, [2013-10-10T10:17:22.984205 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: Mechanism none was requested, but isn't a known type. Ignoring it.
D, [2013-10-10T10:17:22.984236 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: trying publickey
D, [2013-10-10T10:17:22.984417 #12659] DEBUG -- net.ssh.authentication.agent[3fdf32522fc8]: connecting to ssh-agent
D, [2013-10-10T10:17:22.984496 #12659] DEBUG -- net.ssh.authentication.agent[3fdf32522fc8]: sending agent request 1 len 51
D, [2013-10-10T10:17:22.984572 #12659] DEBUG -- net.ssh.authentication.agent[3fdf32522fc8]: received agent packet 2 len 5
D, [2013-10-10T10:17:22.984606 #12659] DEBUG -- net.ssh.authentication.agent[3fdf32522fc8]: sending agent request 11 len 0
D, [2013-10-10T10:17:22.984665 #12659] DEBUG -- net.ssh.authentication.agent[3fdf32522fc8]: received agent packet 12 len 472
D, [2013-10-10T10:17:22.984874 #12659] DEBUG -- net.ssh.authentication.methods.publickey[3fdf325235b8]: trying publickey (d8:2a:ca:8d:b2:ee:44:27:3e:fc:fa:eb:9e:45:75:40)
D, [2013-10-10T10:17:22.984985 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 5 type 50 len 508
D, [2013-10-10T10:17:22.985036 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 532 bytes
D, [2013-10-10T10:17:22.986895 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 84 bytes
D, [2013-10-10T10:17:22.986976 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 5 type 51 len 60
D, [2013-10-10T10:17:22.987043 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: allowed methods: publickey,gssapi-keyex,gssapi-with-mic,password
D, [2013-10-10T10:17:22.987077 #12659] DEBUG -- net.ssh.authentication.session[3fdf3251f468]: trying password
D, [2013-10-10T10:17:22.987154 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 6 type 50 len 60
D, [2013-10-10T10:17:22.987199 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 84 bytes
D, [2013-10-10T10:17:22.988373 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 36 bytes
D, [2013-10-10T10:17:22.988445 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 6 type 52 len 12
D, [2013-10-10T10:17:22.988505 #12659] DEBUG -- net.ssh.authentication.methods.password[3fdf3252ba88]: password succeeded
D, [2013-10-10T10:17:22.988699 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 7 type 90 len 44
D, [2013-10-10T10:17:22.988791 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 68 bytes
D, [2013-10-10T10:17:22.991321 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 52 bytes
D, [2013-10-10T10:17:22.991419 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 7 type 91 len 28
I, [2013-10-10T10:17:22.991496 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_open_confirmation: 0 0 0 32768
I, [2013-10-10T10:17:22.991567 #12659] INFO -- net.ssh.connection.channel[3fdf3252a4d0]: sending channel request "auth-agent-req@openssh.com"
D, [2013-10-10T10:17:22.991637 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 8 type 98 len 44
I, [2013-10-10T10:17:22.991753 #12659] INFO -- net.ssh.connection.channel[3fdf3252a4d0]: sending channel request "env"
D, [2013-10-10T10:17:22.991831 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 9 type 98 len 44
I, [2013-10-10T10:17:22.991951 #12659] INFO -- net.ssh.connection.channel[3fdf3252a4d0]: sending channel request "exec"
D, [2013-10-10T10:17:22.992017 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 10 type 98 len 44
D, [2013-10-10T10:17:22.992086 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: sent 204 bytes
D, [2013-10-10T10:17:22.992903 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 124 bytes
D, [2013-10-10T10:17:22.992993 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 8 type 99 len 12
I, [2013-10-10T10:17:22.993036 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_success: 0
D, [2013-10-10T10:17:22.993080 #12659] DEBUG -- net.ssh.service.forward[3fdf3252ecd8]: authentication agent forwarding is active
D, [2013-10-10T10:17:22.993139 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 9 type 93 len 28
I, [2013-10-10T10:17:22.993178 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_window_adjust: 0 +2097152
D, [2013-10-10T10:17:22.993234 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 10 type 99 len 12
I, [2013-10-10T10:17:22.993267 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_success: 0
D, [2013-10-10T10:17:22.998215 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 68 bytes
D, [2013-10-10T10:17:22.998309 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 11 type 94 len 44
I, [2013-10-10T10:17:22.998391 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_data: 0 22b
D, [2013-10-10T10:17:22.998459 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: read 140 bytes
D, [2013-10-10T10:17:22.998532 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 12 type 96 len 12
I, [2013-10-10T10:17:22.998589 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_eof: 0
D, [2013-10-10T10:17:22.998682 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 13 type 98 len 44
I, [2013-10-10T10:17:22.998755 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_request: 0 exit-status false
D, [2013-10-10T10:17:22.998868 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: received packet nr 14 type 97 len 12
I, [2013-10-10T10:17:22.998923 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: channel_close: 0
D, [2013-10-10T10:17:22.999023 #12659] DEBUG -- tcpsocket[3fdf324cfe7c]: queueing packet nr 11 type 97 len 28
I, [2013-10-10T10:17:22.999089 #12659] INFO -- net.ssh.connection.session[3fdf3252a638]: closing remaining channels (0 open)
<<localhost.localdomain
#!/usr/bin/env ruby
require 'net/ssh'
begin
output = ''
Net::SSH.start('127.0.0.1', 'veewee',
:password => 'veewee',
:port => 7222,
#:auth_methods => ['password'],
:verbose => :debug
) do |ssh|
output = ssh.exec!("hostname")
end
puts "<<#{output}"
rescue Exception => ex
puts ex.inspect
end
D, [2013-10-10T09:48:43.093170 #98782] DEBUG -- net.ssh.transport.session[3fff4da0d264]: establishing connection to 127.0.0.1:7223
D, [2013-10-10T09:48:43.093593 #98782] DEBUG -- net.ssh.transport.session[3fff4da0d264]: connection established
I, [2013-10-10T09:48:43.093687 #98782] INFO -- net.ssh.transport.server_version[3fff4da0c274]: negotiating protocol version
D, [2013-10-10T09:48:43.098544 #98782] DEBUG -- net.ssh.transport.server_version[3fff4da0c274]: remote is `SSH-2.0-OpenSSH_5.3'
D, [2013-10-10T09:48:43.098609 #98782] DEBUG -- net.ssh.transport.server_version[3fff4da0c274]: local is `SSH-2.0-Ruby/Net::SSH_2.7.0 x86_64-darwin12.4.0'
D, [2013-10-10T09:48:43.100318 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: read 784 bytes
D, [2013-10-10T09:48:43.100439 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 0 type 20 len 780
I, [2013-10-10T09:48:43.100512 #98782] INFO -- net.ssh.transport.algorithms[3fff4da148ac]: got KEXINIT from server
I, [2013-10-10T09:48:43.100630 #98782] INFO -- net.ssh.transport.algorithms[3fff4da148ac]: sending KEXINIT
D, [2013-10-10T09:48:43.100768 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 0 type 20 len 1620
D, [2013-10-10T09:48:43.100827 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 1624 bytes
I, [2013-10-10T09:48:43.100858 #98782] INFO -- net.ssh.transport.algorithms[3fff4da148ac]: negotiating algorithms
D, [2013-10-10T09:48:43.100985 #98782] DEBUG -- net.ssh.transport.algorithms[3fff4da148ac]: negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: aes128-cbc
* encryption_client: aes128-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2013-10-10T09:48:43.101012 #98782] DEBUG -- net.ssh.transport.algorithms[3fff4da148ac]: exchanging keys
D, [2013-10-10T09:48:43.101231 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 1 type 34 len 20
D, [2013-10-10T09:48:43.101279 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 24 bytes
D, [2013-10-10T09:48:43.102164 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: read 152 bytes
D, [2013-10-10T09:48:43.102248 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 1 type 31 len 148
D, [2013-10-10T09:48:43.106213 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 2 type 32 len 140
D, [2013-10-10T09:48:43.106290 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 144 bytes
D, [2013-10-10T09:48:43.108923 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: read 720 bytes
D, [2013-10-10T09:48:43.109008 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 2 type 33 len 700
D, [2013-10-10T09:48:43.112141 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 3 type 21 len 20
D, [2013-10-10T09:48:43.112195 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 24 bytes
D, [2013-10-10T09:48:43.112257 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 3 type 21 len 12
D, [2013-10-10T09:48:43.112523 #98782] DEBUG -- net.ssh.authentication.session[3fff4da48508]: beginning authentication of `veewee'
D, [2013-10-10T09:48:43.116969 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 4 type 5 len 28
D, [2013-10-10T09:48:43.117038 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 52 bytes
D, [2013-10-10T09:48:43.117553 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: read 52 bytes
D, [2013-10-10T09:48:43.117650 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 4 type 6 len 28
D, [2013-10-10T09:48:43.117776 #98782] DEBUG -- net.ssh.authentication.session[3fff4da48508]: trying publickey
D, [2013-10-10T09:48:43.118005 #98782] DEBUG -- net.ssh.authentication.agent[3fff4da46460]: connecting to ssh-agent
D, [2013-10-10T09:48:43.118117 #98782] DEBUG -- net.ssh.authentication.agent[3fff4da46460]: sending agent request 1 len 51
D, [2013-10-10T09:48:43.118184 #98782] DEBUG -- net.ssh.authentication.agent[3fff4da46460]: received agent packet 2 len 5
D, [2013-10-10T09:48:43.118291 #98782] DEBUG -- net.ssh.authentication.agent[3fff4da46460]: sending agent request 11 len 0
D, [2013-10-10T09:48:43.118478 #98782] DEBUG -- net.ssh.authentication.agent[3fff4da46460]: received agent packet 12 len 453
D, [2013-10-10T09:48:43.119247 #98782] DEBUG -- net.ssh.authentication.methods.publickey[3fff4da46f64]: trying publickey (85:b8:84:2a:3d:e4:65:44:d4:8c:1d:d2:3f:c2:33:9a)
D, [2013-10-10T09:48:43.119382 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: queueing packet nr 5 type 50 len 508
D, [2013-10-10T09:48:43.119434 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: sent 532 bytes
D, [2013-10-10T09:48:43.126825 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: read 84 bytes
D, [2013-10-10T09:48:43.127034 #98782] DEBUG -- tcpsocket[3fff4da0cc4c]: received packet nr 5 type 51 len 60
D, [2013-10-10T09:48:43.127135 #98782] DEBUG -- net.ssh.authentication.session[3fff4da48508]: allowed methods: publickey,gssapi-keyex,gssapi-with-mic,password
E, [2013-10-10T09:48:43.127180 #98782] ERROR -- net.ssh.authentication.session[3fff4da48508]: all authorization methods failed (tried publickey)
#<Net::SSH::AuthenticationFailed: veewee>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment