cancel
Showing results for 
Search instead for 
Did you mean: 

Why is ExtremeXOS ssh exit status 255 when no error occurs?

Why is ExtremeXOS ssh exit status 255 when no error occurs?

Heitor_Moraes
New Contributor
Hi,

I'm trying to create some scripts to execute commands on Summit boxes using SSH but, even though the commands execute correctly, I always get 255 (-1) as the exit code. From OpenSSH man page I saw that 255 is expected to indicate errors like a connection failure, which clearly is not the case. Isn't EXOS supposed to return 0 when everything works correctly?

Example:
#> ssh user1@summitBox "show version | include Extreme"
Keyboard-interactive authentication
Enter password for user1:
Image : ExtremeXOS version 16.1.2.14 by release-manager

#> echo $?
255
#>
Am I doing something wrong?

From ssh man page:

ssh exits with the exit status of the remote command or with 255 if an error occurred.

The problem with this behavior is that it breaks any automation script that expects a value between 0 and 254 as the return code when no error occurs with the ssh client itself.

Thanks for any tips!
H.
8 REPLIES 8

I got a different result here:

lbrito@LW540 ~ $ ssh admin@10.43.2.42 "show version"Keyboard-interactive authentication
Enter password for admin:
Keyboard-interactive authentication
Enter password for admin:
Switch : 800472-00-08 1246G-01386 Rev 8.0 BootROM: 2.0.1.7 IMG: 15.7.1.4
PSU-1 : Internal Power Supply
PSU-2 :

Image : ExtremeXOS version 15.7.1.4 v1571b4-patch1-2 by release-manager
on Fri May 1 15:16:42 EDT 2015
BootROM : 2.0.1.7
Diagnostics : 6.3

lbrito@LW540 ~ $

I'll try with 15.4.3 p1-10, 15.5.1.6 and 16.1.2.14 and will share the results this afternoon with you.

I did it already! I was just waiting for the first response from support before posting here.

Frank
Contributor II
OK, I'll open one 🙂

Frank
Contributor II
I see the same with 15.4.3 p1-10 and 15.5.1.6
The command looks fine - I was wondering if it didn't like closing without "exit", so I did:
ssh -v user@switch "exit"but that, too, gave me a "-1", i.e. "255"

Heck, even on an interactive ssh session, once you type "exit", the return code is -1/255

Do we need to open a case?
GTM-P2G8KFN