<?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: script to telnet remote machines in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003026#M126883</link>
    <description>I run a variety of scripts on different systems, more or less looking for the same information. We don't use 'r' commands.&lt;BR /&gt;&lt;BR /&gt;Why not run the same script on each server and just e-mail/ftp the results. Having the same script running from cron contains all the ENV variables we require and it is totally secure. That's why I asked why don't you ftp the results and then collate them on one system and post the results to yourself.</description>
    <pubDate>Fri, 20 Jun 2003 05:32:40 GMT</pubDate>
    <dc:creator>Michael Tully</dc:creator>
    <dc:date>2003-06-20T05:32:40Z</dc:date>
    <item>
      <title>script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003020#M126877</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;I need to write a script which does a telnet to the remotes systems specified and run some commands there. With in the script I must be able to supply the user name and password,&lt;BR /&gt;&lt;BR /&gt;I tried something like this but it didnt work,&lt;BR /&gt;&lt;BR /&gt;for i in "sys1 sys2 sys3"&lt;BR /&gt;do&lt;BR /&gt;telnet $i &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;root&lt;BR /&gt;password&lt;BR /&gt;`run some commands`&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there any way out?. I can't make use of rsh as the remote system does not support it.&lt;BR /&gt;&lt;BR /&gt;Pl. help,&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Karthik S S</description>
      <pubDate>Fri, 20 Jun 2003 03:47:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003020#M126877</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-06-20T03:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003021#M126878</link>
      <description>Hi Karthik,&lt;BR /&gt;&lt;BR /&gt;You won't be able to do the telnet like this as the password can never be passed in this fashion in HP-UX.&lt;BR /&gt;&lt;BR /&gt;A product called "expect" will let do that kind of thing but I don't know the product myself.&lt;BR /&gt;&lt;BR /&gt;My personal suggestions are either to create a trust between the 2 systems so you can use "remsh" (not the most secure option) or install SSH on your systems and use "ssh" to run the commands (much more secure).&lt;BR /&gt;&lt;BR /&gt;Ollie.</description>
      <pubDate>Fri, 20 Jun 2003 03:54:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003021#M126878</guid>
      <dc:creator>Ollie R</dc:creator>
      <dc:date>2003-06-20T03:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003022#M126879</link>
      <description>I'm not sure why you would do this. The way you have the script set up, you may as well have a .rhosts/hosts.equiv file. Why not run them on the local system and then ftp the log file afterwards.</description>
      <pubDate>Fri, 20 Jun 2003 03:57:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003022#M126879</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2003-06-20T03:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003023#M126880</link>
      <description>Hi Karthik,&lt;BR /&gt;&lt;BR /&gt;There are two major issues with your approach. Logging in directly as root and storing it's password in a text file. I suggest you use ssh for automated jobs. &lt;BR /&gt;&lt;BR /&gt;If you are willing to take the risk, you can use 'expect' to achieve what you want. But you would need to understand it a bit before you can start on it.&lt;BR /&gt;&lt;BR /&gt;Look at the following thread. I gave a simple example (in real world, you would be keeping a lot  of error checking) on how expect can make interactive sessions non-interactive. There are examples available with expect that can help you understand it better.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x54e2c6af36b7d5118ff10090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x54e2c6af36b7d5118ff10090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Fri, 20 Jun 2003 04:04:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003023#M126880</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-06-20T04:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003024#M126881</link>
      <description>Thank you sridhar .. expect is the right thing I am looking for ...&lt;BR /&gt;&lt;BR /&gt;Ollie/michael:&lt;BR /&gt;I need this because I need to take battery status every week from some 20 odd Sun T3 arrays which does not support any "r" commands. And I wanted to automate this using cron. &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Karthik</description>
      <pubDate>Fri, 20 Jun 2003 04:54:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003024#M126881</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-06-20T04:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003025#M126882</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;But how do I pass multiple hosts to expect for doing some common tasks?? If I call the expect script from within a shell script it doesnt take the environmental variables...&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Karthik</description>
      <pubDate>Fri, 20 Jun 2003 05:03:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003025#M126882</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-06-20T05:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003026#M126883</link>
      <description>I run a variety of scripts on different systems, more or less looking for the same information. We don't use 'r' commands.&lt;BR /&gt;&lt;BR /&gt;Why not run the same script on each server and just e-mail/ftp the results. Having the same script running from cron contains all the ENV variables we require and it is totally secure. That's why I asked why don't you ftp the results and then collate them on one system and post the results to yourself.</description>
      <pubDate>Fri, 20 Jun 2003 05:32:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003026#M126883</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2003-06-20T05:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003027#M126884</link>
      <description>You can do pretty much what you wanted to do in the first place, of course with less reliability than expect but just using sh.&lt;BR /&gt;Take a look here : &lt;BR /&gt;&lt;A href="http://steve-parker.org/sh/expct.shtml" target="_blank"&gt;http://steve-parker.org/sh/expct.shtml&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers</description>
      <pubDate>Fri, 20 Jun 2003 09:20:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003027#M126884</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2003-06-20T09:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003028#M126885</link>
      <description>I'm with Sridhar here, and urge you to use scp and ssh instead of telnet, ftp, and the 'r' utilities (rsh {remsh}) and rcp).  Telnet and ftp cannot easily be scripted: you can do a work-around with expect, but it IS a work-around and not a real solution to the problem.&lt;BR /&gt;&lt;BR /&gt;Install secure shell and use scp and ssh.  These are secure, they're easily scripted, and they're free.  The only drawback is that they're a little slow on the initial connection while they swap public/private keys. But otherwise they're a dream to use, and they fundamentally solve your problem.  Here's a quick-and-dirty example.&lt;BR /&gt;&lt;BR /&gt;for HOST in HOST1 HOST2 HOST3 HOST4&lt;BR /&gt;do&lt;BR /&gt;     ssh $HOST "Run command"&amp;gt;&amp;gt;/tmp/txtfile&lt;BR /&gt;done&lt;BR /&gt;cat /tmp/txtfile|mailx -s "textfile" me@somewhere.com&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 20 Jun 2003 13:17:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003028#M126885</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-06-20T13:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003029#M126886</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;As I have already told you I am using expect for collecting the battery status on Sun StorEdge T3 work group arrays which only supports telnet and ftp. Hence I cant use ssh on it ....&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Karthik</description>
      <pubDate>Sat, 21 Jun 2003 02:04:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003029#M126886</guid>
      <dc:creator>Karthik S S</dc:creator>
      <dc:date>2003-06-21T02:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003030#M126887</link>
      <description>Since it only supports telnet and ftp... and you've already seen that telnet doesn't seem to be a solution, use ftp instead. This can be put into a script.&lt;BR /&gt;&lt;BR /&gt;SRVR="sys1 sys2 sys3"&lt;BR /&gt;for i in $SRVR&lt;BR /&gt;do&lt;BR /&gt;/bin/ftp -n $i | tee /tmp/$i-ftp.log &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;user username password&lt;BR /&gt;ascii&lt;BR /&gt;cd /path&lt;BR /&gt;get file_1&lt;BR /&gt;get file_2&lt;BR /&gt;..more ftp commands..etc..&lt;BR /&gt;quit&lt;BR /&gt;EOF&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This may work for you. I wouldn't do this for root as you woudn't want roots passw being sent in clear text. I'd suggest creating a user account that you could lock down for this purpose.&lt;BR /&gt;&lt;BR /&gt;My scripting skills are mediocre at best, so make your changes and test to suit your needs.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;-denver</description>
      <pubDate>Sat, 21 Jun 2003 03:16:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003030#M126887</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2003-06-21T03:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: script to telnet remote machines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003031#M126888</link>
      <description>Adding a "sleep 2" between each command will help.  I've done this on telnet scripts before with good success.  If it's not there, the feed of info to telnet will be too quick to allow it to respond properly.</description>
      <pubDate>Sat, 21 Jun 2003 15:47:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-telnet-remote-machines/m-p/3003031#M126888</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2003-06-21T15:47:20Z</dc:date>
    </item>
  </channel>
</rss>

