<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: using telnet command in shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950474#M89162</link>
    <description>Hello,&lt;BR /&gt;If you want simply use a script you can do that. But it's totally unsecure.&lt;BR /&gt;&lt;BR /&gt;In a file (name ToDo) put all commands you want to pass in the telnet session. &lt;BR /&gt;&lt;USER&gt;&lt;BR /&gt;&lt;PASSWD&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;EXIT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In an other file "ScriptFile"&lt;BR /&gt;telnet @IP &amp;lt; ToDo&lt;BR /&gt;&lt;BR /&gt;And execute ScriptFile&lt;BR /&gt;&lt;BR /&gt;It works in a lot of case.&lt;/EXIT&gt;&lt;/PASSWD&gt;&lt;/USER&gt;</description>
    <pubDate>Tue, 15 Apr 2003 07:40:45 GMT</pubDate>
    <dc:creator>Quinat Romain</dc:creator>
    <dc:date>2003-04-15T07:40:45Z</dc:date>
    <item>
      <title>using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950467#M89155</link>
      <description>Hi every body,&lt;BR /&gt;&lt;BR /&gt;I need to connect to remote server, automatically using cron tab in Linux . For that i would like to write a shell script.&lt;BR /&gt;&lt;BR /&gt;echo `telnet &lt;IP&gt;`&lt;BR /&gt; when i isuue this command , how can i supply username and password to this shell script.&lt;BR /&gt;&lt;BR /&gt;Can any one please could help me in this same &lt;BR /&gt;above.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.&lt;BR /&gt;&lt;BR /&gt;Rama&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/IP&gt;</description>
      <pubDate>Mon, 14 Apr 2003 10:14:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950467#M89155</guid>
      <dc:creator>ramatulasi</dc:creator>
      <dc:date>2003-04-14T10:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950468#M89156</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;You need to use expect.&lt;BR /&gt;SOmething like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect&lt;BR /&gt;set username &lt;USERNAME&gt;&lt;BR /&gt;set password &lt;PASSWORD&gt;&lt;BR /&gt;&lt;BR /&gt;spawn telnet &lt;HOSTNAME&gt;&lt;BR /&gt;&lt;BR /&gt;expect {&lt;BR /&gt; -re "\[L|l\]ogin:" {&lt;BR /&gt;    if { $mode != "PasswordSent" } {&lt;BR /&gt;      set timeout 1&lt;BR /&gt;      set mode SendLogin&lt;BR /&gt;      exp_continue&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  -re ".*Password:" {&lt;BR /&gt;    set timeout 1&lt;BR /&gt;    set mode SendPassword&lt;BR /&gt;    exp_continue&lt;BR /&gt;  }&lt;BR /&gt;}  &lt;BR /&gt;  timeout {&lt;BR /&gt;    switch $mode {&lt;BR /&gt;    &lt;BR /&gt;      SendLogin {&lt;BR /&gt;        send $username&lt;BR /&gt;        send \n&lt;BR /&gt;        exp_continue&lt;BR /&gt;      }&lt;BR /&gt;      SendPassword {&lt;BR /&gt;        send $password&lt;BR /&gt;        send \n&lt;BR /&gt;    &lt;BR /&gt;        set timeout 5&lt;BR /&gt;        exp_continue&lt;BR /&gt;      }&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;catch { interact }&lt;BR /&gt;&lt;BR /&gt;The above probably won't work just like that and it might have some errors as well. It should give you clues as what to do.&lt;BR /&gt;&lt;BR /&gt;But if you're using telnet and are not worried about passwords, why not use rsh instead ? Or even ssh + RSA/DSA authentication ?&lt;BR /&gt;&lt;BR /&gt;G.&lt;/HOSTNAME&gt;&lt;/PASSWORD&gt;&lt;/USERNAME&gt;</description>
      <pubDate>Mon, 14 Apr 2003 11:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950468#M89156</guid>
      <dc:creator>Goran Koruga</dc:creator>
      <dc:date>2003-04-14T11:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950469#M89157</link>
      <description>Use expect to do this ... install it from you distributions RPM's and then type:&lt;BR /&gt;autoexpect -f &lt;FILENAME&gt; telnet hostname&lt;BR /&gt;#where &lt;FILENAME&gt; is replace with the name you want to call the script.  Then when you get your login prompt ocntinue doing whatever you want the script to do. &lt;BR /&gt;&lt;BR /&gt;After the script is created you will need to edit it and remove a few lines out (such as date/time) if you don't the script won't work.  I'm attaching a sample scpect script of mine used to launch stm.&lt;BR /&gt;&lt;BR /&gt;&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 14 Apr 2003 12:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950469#M89157</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-04-14T12:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950470#M89158</link>
      <description>You can also do with Perl, just install the Telnet Module.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Zafar</description>
      <pubDate>Mon, 14 Apr 2003 13:31:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950470#M89158</guid>
      <dc:creator>Zafar A. Mohammed_1</dc:creator>
      <dc:date>2003-04-14T13:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950471#M89159</link>
      <description>I really, really don't recommend that you do this.  It is NOT secure.  Telnet itself is not secure (passwords are sent in cleartext) and hard-coding a password into a shell script is always a bad idea.  Doing so lets anyone with read access to the script find out what your password is.  &lt;BR /&gt;&lt;BR /&gt;I recommend that you use secure shell instead.  It is supported in almost every version of Linux.  There is nothing you can do in telnet that you also can't do with the secure utilities. &lt;BR /&gt;&lt;BR /&gt;I have attached a document on installing and using secure shell.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 14 Apr 2003 15:37:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950471#M89159</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-04-14T15:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950472#M89160</link>
      <description>If this is testing connectivity only, you could use ICMP.  If this is to execute remote commands, use ssh or rsh.  &lt;BR /&gt;&lt;BR /&gt;I dont recommend opening a telnet session from a script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Mon, 14 Apr 2003 16:29:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950472#M89160</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2003-04-14T16:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950473#M89161</link>
      <description>While it use to be common for ftp to use the .netrc file for automatic logins the security minded have strongly encouraged against it.&lt;BR /&gt;&lt;BR /&gt;Even with the limited ftp command set, this is not recommended.&lt;BR /&gt;&lt;BR /&gt;If you try to automate 'telnet' you can try using the .netrc file but telnet has no limited ftp command set.  In short, you're asking for trouble.&lt;BR /&gt;&lt;BR /&gt;Here is one example of the .netrc login.  You'd create a unique account designed for automatic logins only and add .netrc here.  Here is an example; I've only tested it with ftp:&lt;BR /&gt;&lt;BR /&gt;machine hpxdzg login guest password secret&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90696/B2355-90696_top.html&amp;amp;con=/hpux/onlinedocs/B2355-90696/00/00/73-con.html&amp;amp;toc=/hpux/onlinedocs/B2355-90696/00/00/73-toc.html&amp;amp;searchterms=.netrc&amp;amp;queryid=20030414-134437" target="_blank"&gt;http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90696/B2355-90696_top.html&amp;amp;con=/hpux/onlinedocs/B2355-90696/00/00/73-con.html&amp;amp;toc=/hpux/onlinedocs/B2355-90696/00/00/73-toc.html&amp;amp;searchterms=.netrc&amp;amp;queryid=20030414-134437&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;By the way, your password will be viewable to anyone over the network with tcpdump or ethereal, et al., since it's not encrypted and sent over the LAN in plain text.  This is the main reason people use SSH.&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Apr 2003 18:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950473#M89161</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-04-14T18:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950474#M89162</link>
      <description>Hello,&lt;BR /&gt;If you want simply use a script you can do that. But it's totally unsecure.&lt;BR /&gt;&lt;BR /&gt;In a file (name ToDo) put all commands you want to pass in the telnet session. &lt;BR /&gt;&lt;USER&gt;&lt;BR /&gt;&lt;PASSWD&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;EXIT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In an other file "ScriptFile"&lt;BR /&gt;telnet @IP &amp;lt; ToDo&lt;BR /&gt;&lt;BR /&gt;And execute ScriptFile&lt;BR /&gt;&lt;BR /&gt;It works in a lot of case.&lt;/EXIT&gt;&lt;/PASSWD&gt;&lt;/USER&gt;</description>
      <pubDate>Tue, 15 Apr 2003 07:40:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950474#M89162</guid>
      <dc:creator>Quinat Romain</dc:creator>
      <dc:date>2003-04-15T07:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950475#M89163</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thank You so much for your valuable suggestions.&lt;BR /&gt;&lt;BR /&gt;when i use expect i am getting error saying bad interpretor.what does it means.&lt;BR /&gt;&lt;BR /&gt;i am running it in Linux apache web server&lt;BR /&gt;&lt;BR /&gt;can you help me in that.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.&lt;BR /&gt;&lt;BR /&gt;Rama</description>
      <pubDate>Tue, 15 Apr 2003 08:35:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950475#M89163</guid>
      <dc:creator>ramatulasi</dc:creator>
      <dc:date>2003-04-15T08:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950476#M89164</link>
      <description>Hi every one,&lt;BR /&gt;&lt;BR /&gt;Thank You so much for your valuable suggestions.&lt;BR /&gt;&lt;BR /&gt;when i use expect i am getting error saying bad interpretor.what does it means.&lt;BR /&gt;&lt;BR /&gt;i am running it in Linux apache web server&lt;BR /&gt;&lt;BR /&gt;can you help me in that.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.&lt;BR /&gt;&lt;BR /&gt;Rama</description>
      <pubDate>Tue, 15 Apr 2003 08:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950476#M89164</guid>
      <dc:creator>ramatulasi</dc:creator>
      <dc:date>2003-04-15T08:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: using telnet command in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950477#M89165</link>
      <description>1. pls assign points to responses. &lt;BR /&gt;&lt;BR /&gt;2. what? runing expect in a linux apache web server. &lt;BR /&gt;&lt;BR /&gt;is expect installed. if yes, does the first line of ur script looks something like this.&lt;BR /&gt;&lt;BR /&gt;#!/path/to/expect.&lt;BR /&gt;&lt;BR /&gt;if not download the binary package for expect and install it.&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;-balaji</description>
      <pubDate>Tue, 15 Apr 2003 09:14:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-telnet-command-in-shell-script/m-p/2950477#M89165</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-04-15T09:14:33Z</dc:date>
    </item>
  </channel>
</rss>

