cancel
Showing results for 
Search instead for 
Did you mean: 

protocol error, doesn't start with scp!

tj_renna
New Contributor II
in lieu of any actual ansible modules, i am trying to make raw ssh commands work to an ICX 7750 switch, but even "ssh "show version"" fails with the following error "Protocol error, doesn't start with scp!".  This works on Cisco devices.  How can i enable the ssh service on the switch, or the ssh client to make this functionality work?  
20 REPLIES 20

michael_brado
Esteemed Contributor II
What error do you get when you follow Lauren Miller's advice, only scp remote commands are supported?

I don't understand what SCP REMOTE COMMANDS mean, I just want to run a bash script on a linux server that would remotely ssh on the switch and give a traceroute report. Can you help on this? Command is             
sshpass -p ${PASSWORD} ssh -o StrictHostKeyChecking=no -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"

Can you help? Works perfectly on Cisco though.

michael_brado
Esteemed Contributor II
It has been explained above that bash script ssh is not supported on ICX switches:

Otherwise, the ICX supports 'scp' using the remote command functionality, and if you try to use the remote command function with a different command than scp, it generates this error because it is not 'scp' and in the format it is expecting.

lauren_miller_6
New Contributor
Hi,

   Again (and my apologies if it was not clear the first time!), the ICX does not support issuing ironware commands such as 'show version' etc, outside of an actual login shell. When you issue 'ssh .. ' you are authenticating over ssh, but not explicitly starting a shell on the device. Secure copy is a special case.. why? because when you launch 'scp' on your ssh client, the 'client-side' is the Linux/windows device, and the ICX needs to respond as an scp 'server' (as opposed to 'show version' etc where the ICX needs to act as both client and server for the command/response). Since the ICX does not support remote commands unless executed as a client from a local shell, the only 'server' command it will support is an scp request.. hence why you see the error! 


    Now, as to your particular issue. Since you need to launch a shell to run a command, there are many ways you can script this. I have written a very quick example of how you could do this with python/pexpect, but there are lots of other ways to accomplish this if you prefer other languages:

Call the script 'myscript.py' or whatever, and issue 'python myscript.py'
to run. I hope this helps?

######################################################
import pexpect
import time
import os
import getpass

MY_CMD = 'traceroute 1.1.1.1 numeric'

def get_params():
    icx_user = raw_input('Enter username: ')
    icx_password = getpass.getpass()
    icx_host = raw_input('Enter Host: ')
    return icx_user,icx_password, icx_host
def icx_session(icx_user, icx_password, icx_host):
    # Spawn a session
    icx_s = pexpect.spawn('ssh '+icx_user+'@'+icx_host)
    icx_s.expect('word')
    icx_s.sendline(icx_password)
    icx_s.expect('#')
    icx_s.sendline('skip')
    icx_s.expect('#')
    icx_s.sendline(MY_CMD)
    icx_s.expect('#')
    my_out = icx_s.before
    icx_s.sendline('exit')
    icx_s.expect('>')
    icx_s.sendline('exit')
    icx_s.expect('$')
    icx_s.close
    return my_out

p1,p2,p3 = get_params()
print icx_session(p1,p2,p3)


#######################################################

cyrille_david
New Contributor
Thanks all for your explanations that effectively confirm this lack in Ruckus ssh implementation.
Informations could be found on other forums as well.

For those not willing to use Python, and would rather rely on a 'Windows solution', I manage to script communications to switch using Kitty or Rutty (Putty enhanced version) in order to get output of CLI commands from a Ruckus switchs.
"wait for response from host" parameter set
"use conditions from file" parameter set

Sample text script below relying on  expectations starting with column ':' made the trick.

==========
:SSH@
enable
:Password:
ENABLE_PASSWD
:SSH@
skip-page-display
:SSH@
show interface brief
:SSH@
show mac-address
:SSH@
exit
:SSH@
exit
==========

Wish switch code will  be able to support SSH Remote commands one days, as per all other Network devices  around.
Good luck all.