in reply to Net::OpenSSH and Extreme Switch

Usually these boxes do not allow running single commands via SSH but just a custom/restricted shell.

What happens when you try to invoke the remote command with SSH as in...?

$ /usr/local/bin/ssh auto_config@management show vlan

If it doesn't work, your best option will probably be to use Expect (alone, combined with Net::OpenSSH or via Net::SSH::Expect).

For simple cases, usually this also works:

my $out = $ssh->capture({stdin_data => "show vlan\n"}); print "output: $out"

Replies are listed 'Best First'.
Re^2: Net::OpenSSH and Extreme Switch
by rdl (Initiate) on Nov 23, 2009 at 22:09 UTC

    Salva, thanks for the reply.

    When I try your suggestion from the command line, I get no reply (or error) at all.

    For the second, I modified the script as you suggested

    my $test = $ssh->capture( {stdin_data => "show vlan\n"} );
    and I now get the following:
    Keyboard-interactive authentication Sending a command Pseudo-terminal will not be allocated because stdin is not a terminal. Operation did not work: child exited with code 255 at ./ssh1.pl line 1 +3. Output is: show vlan

    I guess I don't understand why if it works from the command line using OpenSSH, it won't work from the script.

    Thanks

        According to Extreme, they officially do not support 1 line ssh commands and do not seem interested in changing that.

        Strike one for Extreme switches

        thanks again!

        Salva, thanks for the clarification. I believe that I am starting to understand now. Not being big on SSH (Ok, I simply don't like it), I did not understand the two modes. I have a script that I have been using for several years using the Net::Telnet module with great success. I am trying to migrate this script to using SSH but not having a lot of luck. Was hoping that this module would be more of a "drop in" replacement (understanding that specifics would have to change).

        I was hoping to avoid expect, but will look into that option further.

        Thanks again for the support.