<?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: Scripting Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283946#M882352</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use the PreferredAuthentications option while doing an ssh to the remote host. For ex.,&lt;BR /&gt;&lt;BR /&gt;ssh -o "PreferredAuthentications publickey" -o "StrictHostKeyChecking no" $host do_something &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "$HOST: Successful"&lt;BR /&gt;else&lt;BR /&gt;echo "$HOST: Unsuccessful"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;With "PreferredAuthentications publickey" option, if publickey doesn't work, ssh won't go the keyboard-interactive method and will fail. Also, it is a good idea to use "StrictHostKeyChecking no" it will automatically accept the hostkey for any system that was not trusted before. Otherwise, it will throw an interactive session with a choice of yes\no to select. These two options work with 3.7 version. If you have a different version, look at the man page to find the corresponding options.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Sun, 23 May 2004 01:22:22 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2004-05-23T01:22:22Z</dc:date>
    <item>
      <title>Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283945#M882351</link>
      <description>Oh Gods of the scripting world,&lt;BR /&gt;&lt;BR /&gt;I'm stuck on a simple ksh script I'm writing.  The purpose of the&lt;BR /&gt;script is to test the ssh connectivity without password prompts&lt;BR /&gt;between my database and app servers.  &lt;BR /&gt;&lt;BR /&gt;There are others in the company who for some reason mess up the keys,&lt;BR /&gt;and I have to regen and propagate new keys to all of the servers.  DNS&lt;BR /&gt;changes mess things up as well.&lt;BR /&gt;&lt;BR /&gt;Anyway,  I need to make sure that when I enter "ssh &lt;SERVER&gt;" I get in&lt;BR /&gt;without a passowrd.  If it prompts me for a password, the keys are off&lt;BR /&gt;and my other scripts will fail.&lt;BR /&gt;&lt;BR /&gt;In the script I run the following (variables changed to constants just&lt;BR /&gt;for demo purposes):&lt;BR /&gt;&lt;BR /&gt;# -- Remove temp file just in case&lt;BR /&gt;rm -f /tmp/testappserver1.txt 1&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;# -- Test the connection to the file&lt;BR /&gt;ssh appserver1 'uname -a' &amp;gt;/tmp/testappserver1.txt 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;# -- If the file exists and is larger than 0 bytes &lt;BR /&gt;# -- then connection is good, else connection&lt;BR /&gt;# -- didn't work&lt;BR /&gt;if [ -s /tmp/testappserver1.txt ]; then&lt;BR /&gt; echo "SSH connectivity ok to appserver1"&lt;BR /&gt;else&lt;BR /&gt; echo "The ssh connection to appserver1 does not work."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# -- Remove temp file&lt;BR /&gt;rm -f /tmp/test${1}.txt 1&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;This works great if the keys are set right and will detect an error&lt;BR /&gt;when the DNS monkeys at my company changes the underlying IP addresses&lt;BR /&gt;without telling us.&lt;BR /&gt;&lt;BR /&gt;But if the keys are off, it justs prompts me for a password.  I need&lt;BR /&gt;to capture that somehow and say that's an error.  &lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,  Marly&lt;BR /&gt;&lt;BR /&gt;marly dot thomas at wamu dot net &lt;NOSPAM&gt; or&lt;BR /&gt;marly38 at comcast dot net &lt;NOSPAM&gt;&lt;/NOSPAM&gt;&lt;/NOSPAM&gt;&lt;/SERVER&gt;</description>
      <pubDate>Sat, 22 May 2004 14:14:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283945#M882351</guid>
      <dc:creator>Marly Thomas</dc:creator>
      <dc:date>2004-05-22T14:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283946#M882352</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use the PreferredAuthentications option while doing an ssh to the remote host. For ex.,&lt;BR /&gt;&lt;BR /&gt;ssh -o "PreferredAuthentications publickey" -o "StrictHostKeyChecking no" $host do_something &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "$HOST: Successful"&lt;BR /&gt;else&lt;BR /&gt;echo "$HOST: Unsuccessful"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;With "PreferredAuthentications publickey" option, if publickey doesn't work, ssh won't go the keyboard-interactive method and will fail. Also, it is a good idea to use "StrictHostKeyChecking no" it will automatically accept the hostkey for any system that was not trusted before. Otherwise, it will throw an interactive session with a choice of yes\no to select. These two options work with 3.7 version. If you have a different version, look at the man page to find the corresponding options.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Sun, 23 May 2004 01:22:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283946#M882352</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-05-23T01:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283947#M882353</link>
      <description>Thanks Sri - I'll give that a try an let you know!&lt;BR /&gt;&lt;BR /&gt;Marly</description>
      <pubDate>Sun, 23 May 2004 01:33:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283947#M882353</guid>
      <dc:creator>Marly Thomas</dc:creator>
      <dc:date>2004-05-23T01:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283948#M882354</link>
      <description>Sri - that worked great - very eloquent method!  10 points for you bud!&lt;BR /&gt;&lt;BR /&gt;Marly</description>
      <pubDate>Sun, 23 May 2004 01:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3283948#M882354</guid>
      <dc:creator>Marly Thomas</dc:creator>
      <dc:date>2004-05-23T01:45:30Z</dc:date>
    </item>
  </channel>
</rss>

