<?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: ssh timeout in a script? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880388#M744285</link>
    <description>there was a posting on itrc, but I'm searching for it since a week and can't find it myself anymore.&lt;BR /&gt;&lt;BR /&gt;It was based on restricting the authentication method to public key - somehow...</description>
    <pubDate>Mon, 17 Jan 2005 10:46:45 GMT</pubDate>
    <dc:creator>Florian Heigl (new acc)</dc:creator>
    <dc:date>2005-01-17T10:46:45Z</dc:date>
    <item>
      <title>ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880387#M744284</link>
      <description>I run a script weekly from cron on a HP-UX 11.00 server which collects system info from other servers on our network.&lt;BR /&gt;The server on which I run this script (the "admin server") is running SSH 3.81 as  are some of the others. Other nodes are all running HP-UX, either 10.20, 11.00 or 11.11&lt;BR /&gt;My script loops through a list of servers, and first checks to see if ssh is installed on the remote server - if it is, it collects the info by remotely running ssh commands, otherwise it uses remsh.&lt;BR /&gt;My problem is that I am not the only SysAdmin, and some people have been installing ssh on various servers (fine) but they aren't setting up the authorized_keys file to accept passwordless logins from the admin server (bad). The result is that I sometimes come in on Monday to find the script still sitting there because it's been waiting for a password since Sunday afternoon.&lt;BR /&gt;&lt;BR /&gt;This was the original form of the test for ssh on the remote servers:&lt;BR /&gt;if ssh $host uname&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;then&lt;BR /&gt;   REMSH=ssh&lt;BR /&gt;else&lt;BR /&gt;   REMSH=remsh&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;This works fine if ssh is not installed on $host, and works equally well if ssh is installed, and authorized_keys is present and correct. It only fails when authorized_keys doesn't contain a valid entry for the admin host.&lt;BR /&gt;&lt;BR /&gt;I have trawled these forums, and I have tried suggested command-line options for ssh to try to detect a failed attempt due to no authorized_keys entry, but the suggestions I've found don't work:&lt;BR /&gt;1)&lt;BR /&gt;if ssh -o LoginGraceTime=30 node2 uname&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;then&lt;BR /&gt;   echo ssh worked&lt;BR /&gt;else&lt;BR /&gt;   echo ssh failed&lt;BR /&gt;fi&lt;BR /&gt;This always produces the error:&lt;BR /&gt;command-line: line 0: Bad configuration option: LoginGraceTime&lt;BR /&gt;ssh failed&lt;BR /&gt;&lt;BR /&gt;2)&lt;BR /&gt;if ssh -o ServerAliveInterval=20 -o ServerAliveCountMax=3 node2 uname&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;then&lt;BR /&gt;   echo ssh worked&lt;BR /&gt;else&lt;BR /&gt;   echo ssh failed&lt;BR /&gt;fi&lt;BR /&gt;This only works if the ssh is successful (i.e. authorized_keys is present and correct). If it isn't it just sits there waiting for a password until I ^C it.&lt;BR /&gt;&lt;BR /&gt;Is there a way to detect whether a host will allow a passwordless ssh login/remote command, and/or to force a timeout (say 60 seconds) if the attempt doesn't return successfully in that time?&lt;BR /&gt;&lt;BR /&gt;Thanks in anticipation&lt;BR /&gt;Gordon</description>
      <pubDate>Mon, 17 Jan 2005 10:33:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880387#M744284</guid>
      <dc:creator>Gordon  Morrison_1</dc:creator>
      <dc:date>2005-01-17T10:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880388#M744285</link>
      <description>there was a posting on itrc, but I'm searching for it since a week and can't find it myself anymore.&lt;BR /&gt;&lt;BR /&gt;It was based on restricting the authentication method to public key - somehow...</description>
      <pubDate>Mon, 17 Jan 2005 10:46:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880388#M744285</guid>
      <dc:creator>Florian Heigl (new acc)</dc:creator>
      <dc:date>2005-01-17T10:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880389#M744286</link>
      <description>what about background ssh?&lt;BR /&gt;&lt;BR /&gt;You fire everything up background and what hangs hangs. &lt;BR /&gt;&lt;BR /&gt;~^Z&lt;BR /&gt;&lt;BR /&gt;Thats the command line option.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 17 Jan 2005 11:05:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880389#M744286</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-01-17T11:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880390#M744287</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;try to put 'LoginGraceTime 600' in your ssh.config.&lt;BR /&gt;&lt;BR /&gt;Then it should be work&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;Michael</description>
      <pubDate>Mon, 17 Jan 2005 11:54:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880390#M744287</guid>
      <dc:creator>Michael_356</dc:creator>
      <dc:date>2005-01-17T11:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880391#M744288</link>
      <description>Try&lt;BR /&gt;&lt;BR /&gt;$ ssh -o PreferredAuthentications=publickey &lt;HOST&gt;&lt;BR /&gt;&lt;BR /&gt;It should fail if &lt;HOST&gt;:.ssh/authorized_keys is not setup.&lt;/HOST&gt;&lt;/HOST&gt;</description>
      <pubDate>Mon, 17 Jan 2005 21:22:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880391#M744288</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-01-17T21:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880392#M744289</link>
      <description>This sounds like a bug in this version as I have used these kinds of tests in the past and they have worked.&lt;BR /&gt;&lt;BR /&gt;One possible workaround could be to spawn a separate background script that writes to several flag files e.g. script-started, key-OK, failed. Your command script then waits for an arbitory length of time then checks the status files to see if the host is accepting the key.&lt;BR /&gt;&lt;BR /&gt;If successful proceed with the transfer, otherwise delete the flag files and kill the other script.&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Jan 2005 02:57:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880392#M744289</guid>
      <dc:creator>Andrew Cowan</dc:creator>
      <dc:date>2005-01-18T02:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880393#M744290</link>
      <description>Thanks to all for the swift replies:&lt;BR /&gt;Florian - You were on the right track (see below)&lt;BR /&gt;Steven - I see what you're saying here, but it wouldn't be my preferred option in this case.&lt;BR /&gt;Michael - I already tried that, really not sure why it didn't work (yes, I did a kill -HUP after changing the config)&lt;BR /&gt;Ermin - WooHoo! This looks like what Florian was thinking of and it works! Thanks.&lt;BR /&gt;Andrew - Like Steven's suggestion, it could work, but wouldn't be my first choice in this situation.&lt;BR /&gt;&lt;BR /&gt;Thanks again to all.</description>
      <pubDate>Tue, 18 Jan 2005 04:48:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880393#M744290</guid>
      <dc:creator>Gordon  Morrison_1</dc:creator>
      <dc:date>2005-01-18T04:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: ssh timeout in a script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880394#M744291</link>
      <description>Someone give Ermin a rabbit!</description>
      <pubDate>Tue, 18 Jan 2005 04:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ssh-timeout-in-a-script/m-p/4880394#M744291</guid>
      <dc:creator>Gordon  Morrison_1</dc:creator>
      <dc:date>2005-01-18T04:54:15Z</dc:date>
    </item>
  </channel>
</rss>

