# Net::SSH Problems

**URL:** <https://www.ruby-forum.com/t/net-ssh-problems/140330>\
**Category:** Ruby\
**Created:** [June 13, 2008, 12:40am UTC](https://www.ruby-forum.com/t/net-ssh-problems/140330 "2008-06-13T00:40:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_ESHubbard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@Nicholas\_ESHubbard](https://www.ruby-forum.com/u/Nicholas_ESHubbard)\
**Post date:** [June 13, 2008, 12:40am UTC](https://www.ruby-forum.com/t/net-ssh-problems/140330/1 "2008-06-13T00:40:29Z")

</div>

Ok Guys,

I have bet my head against this all day long. I have no clue what is  
going on at all.

Jamis or anyone else, if you have any thoughts/input please share.

# (Pasted from: [http://pastie.org/214070](http://pastie.org/214070))

# CODE:

def login\_to\_server  
Net::SSH.start(self.ip\_address, self.username, :password =\>  
self.password, :paranoid =\> false)  
end

def get\_tty(ssh)  
puts “\*\*\*\*\*\*\*SSH: #{ssh}”  
channel = ssh.open\_channel  
puts “\*\*\*\*\*\*\*CHANNEL: #{channel}”  
return channel.request\_pty

end

# def run\_command(ssh, command) ssh.exec!(command) end

# PUTS COMMAND RETURNS: \*\*\*\*\*\*\*\*\*RESULTS: stdin: is not a tty nhubbard stdin: is not a tty Linux 2.6.18-53.1.14.el5 x86\_64 \*\*\*\*\*\*\*SSH: #Net::SSH::Connection::Session:0x2379ff4 \*\*\*\*\*\*\*CHANNEL: #Net::SSH::Connection::Channel:0x2365928

# ERROR:

Processing ComputersController#index (for 127.0.0.1 at 2008-06-12  
17:18:39) [GET]  
Session ID:  
BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo  
SGFzaHsABjoKQHVzZWR7AA==–46e23fd2f9bd7817c46c0c837e6746d6eb072fdf  
Parameters: {“action”=\>“index”, “controller”=\>“computers”}  
Computer Load (0.000261) SELECT \* FROM “computers” WHERE  
(“computers”.“id” = 3)  
Rendering computers/index

ActionView::TemplateError (can’t convert nil into Integer) on line #14  
of computers/index.html.erb:  
11: results = @computer.run\_command(ssh, “whoami”)  
12: results \<\< @computer.run\_command(ssh, “uname -i -r -s”)  
13: puts “\*\*\*\*\*\*\*\*\*RESULTS: #{results}”  
14: tty = @computer.get\_tty(ssh)  
15: #Do something you need a tty for, like sudo  
16: %\>  
17:

```
/Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb:

```

293:in `pack' /Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb: 293:in `write\_long’  
/Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb:  
54:in `send' /Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb: 54:in `from’  
/Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb:  
46:in `step' /Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/buffer.rb: 46:in `from’  
/Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/connection/  
channel.rb:465:in `send_channel_request' /Library/Ruby/Gems/1.8/gems/net-ssh-2.0.2/lib/net/ssh/connection/ channel.rb:233:in `request\_pty’  
app/models/computer.rb:30:in `get_tty' app/views/computers/index.html.erb:14:in `\_run\_erb\_47app47views47computers47index46html46erb’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/  
base.rb:338:in `send' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/ base.rb:338:in `execute’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/  
template\_handlers/compilable.rb:29:in `send' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/ template_handlers/compilable.rb:29:in `render’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/  
template.rb:35:in `render' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/ template.rb:22:in `render\_template’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/  
base.rb:245:in `render_file' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ base.rb:1108:in `render\_for\_file’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
base.rb:841:in `render_with_no_layout' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ layout.rb:259:in `render\_without\_benchmark’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
benchmarking.rb:51:in `render' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/ core_ext/benchmark.rb:8:in `realtime’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
benchmarking.rb:51:in `render' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ base.rb:1157:in `default\_render’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
base.rb:1163:in `perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ filters.rb:580:in `call\_filters’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
filters.rb:573:in `perform_action_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ benchmarking.rb:68:in `perform\_action\_without\_rescue’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/  
ruby/1.8/benchmark.rb:293:in `measure' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ benchmarking.rb:68:in `perform\_action\_without\_rescue’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
rescue.rb:201:in `perform_action_without_caching' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ caching/sql_cache.rb:13:in `perform\_action’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active\_record/  
connection\_adapters/abstract/query\_cache.rb:33:in `cache' /Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/ query_cache.rb:8:in `cache’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
caching/sql\_cache.rb:12:in `perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ base.rb:529:in `send’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
base.rb:529:in `process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ filters.rb:569:in `process\_without\_session\_management\_support’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
session\_management.rb:130:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ base.rb:389:in `process’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
dispatcher.rb:149:in `handle_request' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ dispatcher.rb:107:in `dispatch’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
dispatcher.rb:104:in `synchronize' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ dispatcher.rb:104:in `dispatch’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/  
dispatcher.rb:120:in `dispatch_cgi' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/ dispatcher.rb:35:in `dispatch’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:  
76:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb: 74:in `synchronize’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:  
74:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process\_client’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in  
`each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process\_client’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in  
`run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in  
`new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in  
`initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in  
`run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:282:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/  
configurator.rb:281:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel\_rails:128:in  
`run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb: 212:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel\_rails:281  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/  
dependencies.rb:502:in `load' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:502:in `load’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/  
dependencies.rb:354:in `new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:502:in `load’  
/Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/servers/  
mongrel.rb:64  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/  
ruby/1.8/rubygems/custom\_require.rb:27:in `gem_original_require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/1.8/rubygems/custom_require.rb:27:in `require’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/  
dependencies.rb:509:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:354:in `new\_constants\_in’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/  
dependencies.rb:509:in `require' /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/1.8/rubygems/custom_require.rb:27:in `gem\_original\_require’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/  
ruby/1.8/rubygems/custom\_require.rb:27:in `require’  
script/server:3

Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/  
action\_controller/templates/rescues/layout.erb (internal\_server\_error)
