SSH NONBLOCK Issue

From: Aaron Smith (asmith_at_nexcerpt.com)
Date: 03/11/04

  • Next message: Aaron Smith: "SSH NONBLOCKING Issue Part II"
    To: secureshell@securityfocus.com
    Date: Thu, 11 Mar 2004 12:30:58 -0500
    
    
    

            We recently upgraded a number of servers here from Redhat 7.3 to
    Whitebox Linux 3.0 (a clone of Redhat Enterprise Linux 3.0). All three
    are running OpenSSH version 3.6.1-p2. After the upgrade, a particular
    perl script that utilizes SSH stopped working properly. Basically, all
    this script did was open a "file" which was a pipe to an ssh command
    (i.e. open(FILE,$cmd)). The ssh command was a simple ssh to another
    machine to cat a particular file.
            If the SSH command is run from the command line, it works fine. When
    run from the script, it hangs. It seems that the actual SSH connection
    is set up and authenticated just fine, but then it hangs waiting for the
    actual output from the cat command. After putting in -vv to the
    commands and comparing the output, the only difference I could find was
    the following debug statements from the scripts version:
    debug2: fd 3 is O_NONBLOCK
    debug1: fd 4 setting O_NONBLOCK

            After doing some googling around, and reading this:
    http://bugzilla.mindrot.org/show_bug.cgi?id=26

            My current theory is that STDOUT is being set to NONBLOCK, preventing
    the output of the cat command from being read. The question, then, is
    what causes that to happen and why is it different in the script vs. in
    the command line. We also created a test script that runs the same
    command in the same way as the main script and that one works just fine
    (and does not have the fd 3 NONBLOCK statement in the debug output..)

    -- 
    -----------------------------------------------------------------
    Aaron Smith             		vox: 269.226.9550 ext.26
    Network Director        		fax: 269.349.9076	
    Nexcerpt, Inc.          		http://www.nexcerpt.com
    	
    	...Nexcerpt... Extend Your Expertise
    
    



  • Next message: Aaron Smith: "SSH NONBLOCKING Issue Part II"

    Relevant Pages

    • Scripts using SSH and SSH_ASKPASS
      ... To test SSH scripts you better destroy the control TTY. ... The trick is to run YOUR script on YOUR local ... As for the password relaying command: this needs not be an X command. ... # we read one line from a temporary pipe. ...
      (comp.security.ssh)
    • Re: remote server backup script
      ... > Just type away at the command line. ... Make a backup of whatever you want ... > command line, in a script. ... >>the server ssh key on the clients machine). ...
      (comp.os.linux.misc)
    • Re: [PHP] SSH and php
      ... % % Is it possible to run a SSH command from php? ... it's possible to run any command from php. ... There are ways to do that -- I personally would create a kick script ...
      (php.general)
    • Using SSH to terminate remote systems for disaster recovery
      ... I have a need to terminate a number of AIX 5.1 systems ... from a single script. ... I can do this using ssh. ... if I issue the shutdown command from ssh, ...
      (AIX-L)
    • RE: Execute script on remote computer
      ... Execute script on remote computer ... you should just use the ssh command coupled with the name of the ...
      (comp.lang.python)