From: Nathan Halterman Date: 2008-11-07T23:42:49+09:00 Subject: Re: Trying to Use "request_pty" Channel Never Closes Last thing, the code above is 2.0 code. Here is the 1.0 code. [code] require 'rubygems' require 'net/ssh' Net::SSH.start('xx.xx.xx.xx', 'userid', "password") do |session| session.open_channel do |channel| channel.on_success do puts "pty was requested successfully!" channel.on_success do puts "shell was started successfully!" channel.send_data "2\n" # tell the shell to exit sleep 3 channel.send_data "1\n" # tell the shell to exit sleep 2 channel.send_data "login" channel.send_data "password" channel.send_data "\n" channel.send_data "0" channel.send_data "2\n" channel.send_data "0\n" end channel.send_request "shell", nil, true end channel.on_failure do puts "shell could not be started!" end channel.on_data do |ch,data| puts "recieved #{data} from shell" end channel.on_close do puts "shell terminated" end channel.request_pty :want_reply => true end session.loop end [/code] -- Posted via http://www.ruby-forum.com/.