# Ruby telnet issue when target platform is SuSE9.2

**URL:** <https://www.ruby-forum.com/t/ruby-telnet-issue-when-target-platform-is-suse9-2/63207>\
**Category:** Ruby\
**Created:** [June 13, 2006, 6:48am UTC](https://www.ruby-forum.com/t/ruby-telnet-issue-when-target-platform-is-suse9-2/63207 "2006-06-13T06:48:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/54ee81/32.png) [@saga](https://www.ruby-forum.com/u/saga)\
**Post date:** [June 13, 2006, 6:48am UTC](https://www.ruby-forum.com/t/ruby-telnet-issue-when-target-platform-is-suse9-2/63207/1 "2006-06-13T06:48:37Z")

</div>

Hi,  
When I use Net/telnet module on target platform SuSE9.2, I got an error  
message like “Tset: Unknown terminal type network”.

I also tried to replace “login” fuction with “Waitfor” fuction, but it  
is still the case.

Furthermore, I try to modify the options “Prompt” to another regular  
expression that matches the prompt of SuSE 9.2, but it still does not  
work.

I used google to search for reasons about this issue.  
And I found maybe the default terminal type of SuSE9.2 should be  
modified to make my program work.

Have anyone met the same problem? And could anyone give me a hand about  
how to configure SuSE9.2 terminal type?

Additional info: my SuSE used bash shell as default shell. And the  
enviroment “TERM” is “xterm” and I examined the “/etc/termcap” and found  
nothing valuable.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![saga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/54ee81/32.png) [@saga](https://www.ruby-forum.com/u/saga)\
**Post date:** [December 14, 2006, 4:03am UTC](https://www.ruby-forum.com/t/ruby-telnet-issue-when-target-platform-is-suse9-2/63207/2 "2006-12-14T04:03:32Z")

</div>

Jia Zhang wrote:

> Hi,  
> When I use Net/telnet module on target platform SuSE9.2, I got an error  
> message like “Tset: Unknown terminal type network”.
> 
> I also tried to replace “login” fuction with “Waitfor” fuction, but it  
> is still the case.
> 
> Furthermore, I try to modify the options “Prompt” to another regular  
> expression that matches the prompt of SuSE 9.2, but it still does not  
> work.
> 
> I used google to search for reasons about this issue.  
> And I found maybe the default terminal type of SuSE9.2 should be  
> modified to make my program work.
> 
> Have anyone met the same problem? And could anyone give me a hand about  
> how to configure SuSE9.2 terminal type?
> 
> Additional info: my SuSE used bash shell as default shell. And the  
> enviroment “TERM” is “xterm” and I examined the “/etc/termcap” and found  
> nothing valuable.
> 
> Thanks a lot!

Hi,  
I solved this problem since I met the same issue as you. Below is my  
code, you can refer to it. Any question, just mail to me:  
removed\_email\_address@domain.invalid

* * *

require ‘net/telnet’

telnet = Net::Telnet.new(‘Host’ =\> ‘Your IP’,  
‘Prompt’ =\> /[ftpusr@suse46:~\>]\*\z/n)  
#The prompt should be the real prompt while you entered your system

## telnet.waitfor(/[Ll]ogin[:]_\z/n) {|c| print c} telnet.cmd(“Your User”) {|c| print c} telnet.waitfor(/Password[:]_\z/n) {|c| print c} telnet.cmd(“Your password”) {|c| print c} telnet.cmd(“dumb”) {|c| print c} #This is must, because in SuSE, by default, the terminal type is “dumb” #Then, send your command here telnet.cmd(‘df -k’){|c| print c} STDOUT.flush #Here, wait for the prompt telnet.waitfor(/[$%#\>] \z/n) {|c| print c} #Then, leave the system telnet.cmd(‘exit’) {|c| print c} telnet.close

Enjoy Ruby!
