I wonder if ruby-lang is a place to talk about specific gems? I
unsubscribed because of that but now receiving the list again,
automagically 
On Friday, 9 August 2013 г. at 13:09, Avery Rozar wrote:
Username did not match 100%, so I did add a : and space. But I still get
the same results. I'm also trying SSH, and I do get authenticated and
logged in. But it errors out when trying to issue the command. I will
look at what you have and see if I can figure out what I'm doing wrong.
Here is what I have for ssh, then the debug.
begin
session = Net::SSH.start(@hostname, @username, :password =>
@password, :encryption => "aes256-cbc", :host_key => "ssh-rsa", :verbose
=> :debug)
session.open_channel do |chan|
chan.send_channel_request('shell') do |ch, success|
if !success
abort 'Could not open shell channel'
else
ch.on_data do |chn, data|
puts data
check_and_send(chn)
end
end
end
end
session.exec(@cmd + '\n') do |success|
if success
puts 'command worked'
else
puts 'no go'
end
end
session.close
end
D, [2013-08-09T05:05:55.141342 #1862] DEBUG --
net.ssh.transport.session[3fe1fd8a43f4]: establishing connection to
172.16.1.1:22
D, [2013-08-09T05:05:55.142325 #1862] DEBUG --
net.ssh.transport.session[3fe1fd8a43f4]: connection established
I, [2013-08-09T05:05:55.142515 #1862] INFO --
net.ssh.transport.server_version[3fe1fd8a23c4]: negotiating protocol
version
D, [2013-08-09T05:05:55.143593 #1862] DEBUG --
net.ssh.transport.server_version[3fe1fd8a23c4]: remote is
`SSH-2.0-Cisco-1.25'
D, [2013-08-09T05:05:55.143712 #1862] DEBUG --
net.ssh.transport.server_version[3fe1fd8a23c4]: local is
`SSH-2.0-Ruby/Net::SSH_2.6.8 x86_64-darwin11.2.0'
D, [2013-08-09T05:05:56.770385 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 280 bytes
D, [2013-08-09T05:05:56.770585 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 0 type 20 len 276
I, [2013-08-09T05:05:56.770678 #1862] INFO --
net.ssh.transport.algorithms[3fe1fd8940f8]: got KEXINIT from server
I, [2013-08-09T05:05:56.770870 #1862] INFO --
net.ssh.transport.algorithms[3fe1fd8940f8]: sending KEXINIT
D, [2013-08-09T05:05:56.773809 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 0 type 20 len 1620
D, [2013-08-09T05:05:56.774001 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 1624 bytes
I, [2013-08-09T05:05:56.774068 #1862] INFO --
net.ssh.transport.algorithms[3fe1fd8940f8]: negotiating algorithms
D, [2013-08-09T05:05:56.774295 #1862] DEBUG --
net.ssh.transport.algorithms[3fe1fd8940f8]: negotiated:
* kex: diffie-hellman-group1-sha1
* host_key: ssh-rsa
* encryption_server: aes256-cbc
* encryption_client: aes256-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2013-08-09T05:05:56.774346 #1862] DEBUG --
net.ssh.transport.algorithms[3fe1fd8940f8]: exchanging keys
D, [2013-08-09T05:05:56.777016 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 1 type 30 len 140
D, [2013-08-09T05:05:56.777141 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 144 bytes
D, [2013-08-09T05:05:56.842775 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 448 bytes
D, [2013-08-09T05:05:56.843002 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 1 type 31 len 444
D, [2013-08-09T05:05:56.848112 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 2 type 21 len 20
D, [2013-08-09T05:05:56.848232 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 24 bytes
D, [2013-08-09T05:05:56.848315 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 16 bytes
D, [2013-08-09T05:05:56.848445 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 2 type 21 len 12
D, [2013-08-09T05:05:56.848873 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: beginning authentication
of `arozar'
D, [2013-08-09T05:05:56.849119 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 3 type 5 len 28
D, [2013-08-09T05:05:56.849232 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 52 bytes
D, [2013-08-09T05:05:56.850632 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 52 bytes
D, [2013-08-09T05:05:56.850808 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 3 type 6 len 28
D, [2013-08-09T05:05:56.850978 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: trying none
D, [2013-08-09T05:05:56.851078 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: Mechanism none was
requested, but isn't a known type. Ignoring it.
D, [2013-08-09T05:05:56.851123 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: trying publickey
D, [2013-08-09T05:05:56.851252 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: connecting to ssh-agent
D, [2013-08-09T05:05:56.851395 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: sending agent request 1 len
51
D, [2013-08-09T05:05:56.851545 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: received agent packet 2 len
5
D, [2013-08-09T05:05:56.851612 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: sending agent request 11 len
0
D, [2013-08-09T05:05:56.851727 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: received agent packet 12 len
5
D, [2013-08-09T05:05:56.851784 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: trying hostbased
D, [2013-08-09T05:05:56.851888 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: sending agent request 11 len
0
D, [2013-08-09T05:05:56.851983 #1862] DEBUG --
net.ssh.authentication.agent[3fe1fd4d18a8]: received agent packet 12 len
5
D, [2013-08-09T05:05:56.852037 #1862] DEBUG --
net.ssh.authentication.session[3fe1fd4d83ec]: trying password
D, [2013-08-09T05:05:56.852212 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 4 type 50 len 76
D, [2013-08-09T05:05:56.852332 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 100 bytes
D, [2013-08-09T05:05:56.854618 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 36 bytes
D, [2013-08-09T05:05:56.854827 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 4 type 52 len 12
D, [2013-08-09T05:05:56.854990 #1862] DEBUG --
net.ssh.authentication.methods.password[3fe1fd4cbebc]: password
succeeded
D, [2013-08-09T05:05:56.855271 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 5 type 90 len 44
D, [2013-08-09T05:05:56.855434 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 6 type 90 len 44
I, [2013-08-09T05:05:56.855504 #1862] INFO --
net.ssh.connection.session[3fe1fd4c727c]: closing remaining channels (2
open)
D, [2013-08-09T05:05:56.855703 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 136 bytes
D, [2013-08-09T05:05:56.857500 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 52 bytes
D, [2013-08-09T05:05:56.857772 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 5 type 91 len 28
I, [2013-08-09T05:05:56.857899 #1862] INFO --
net.ssh.connection.session[3fe1fd4c727c]: channel_open_confirmation: 0 3
1024 4096
I, [2013-08-09T05:05:56.857996 #1862] INFO --
net.ssh.connection.channel[3fe1fd4c7150]: sending channel request
"shell"
D, [2013-08-09T05:05:56.858143 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
queueing packet nr 7 type 98 len 28
D, [2013-08-09T05:05:56.858302 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
sent 52 bytes
D, [2013-08-09T05:05:56.858397 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
read 52 bytes
D, [2013-08-09T05:05:56.858524 #1862] DEBUG -- tcpsocket[3fe1fd8a3774]:
received packet nr 6 type 92 len 28
E, [2013-08-09T05:05:56.858634 #1862] ERROR --
net.ssh.connection.session[3fe1fd4c727c]: channel_open_failed: 1 4
Uncaught exception: (4)
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/channel.rb:524:in
`do_open_failed'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:545:in
`channel_open_failure'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:459:in
`dispatch_incoming_packets'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:216:in
`preprocess'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:200:in
`process'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:164:in
`block in loop'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:164:in
`loop'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:164:in
`loop'
/Users/averyrozar/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.8/lib/net/ssh/connection/session.rb:113:in
`close'
/Users/averyrozar/Ruby-Scripts/tools/ssh-tool.rb:67:in `<top
(required)>'
Process finished with exit code 0
--
Posted via http://www.ruby-forum.com/.