3050 views

Is there a way to issue a command to an NA proxy using SSH non-interactively

Jump to solution

Hello,

I'm trying to use a linux SSH client to send a command to an NA proxy non-interactively. I'm able to do this sort of thing pretty easily with standard linux servers, although I'm not able to get this working with my NA proxies. The command itself is:

ssh  -p someport x.x.x.x show device -ip x.x.x.x

although after the command is entered, I just get the following:

Password
Enter user's password:
Password:
exec request failed on channel 0

Would there be a way to get this working properly? I can always fall back to using something like expect, but being able to use this method would definitely make things easier.

Thank you

 

0 Likes
1 Solution

Accepted Solutions
Lieutenant Commander Lieutenant Commander
Lieutenant Commander

Hello,

I see the same behaviour on NA 10.11.01

it seems NA proxy doesn't support SSH exec request functionality.  This method is used when command is like:

ssh admin@localhost -p 8022 "show version"

 

During iteractive session commands are sent using different SSH function - terminal shell. These commands should work fine:

echo -ne "show version \n quit" |  ssh admin@localhost -p 8022

 or

 

 ssh admin@localhost -p 8022 <<< "show version
> quit"

 

 

Please let me know if this solution works for you

View solution in original post

0 Likes
11 Replies
Fleet Admiral
Fleet Admiral

Hi @lacrosse1991,

you need to place the command like this:

[root@localhost:~] $ssh admin@localhost -p 8022 'reload server options'
Password
Enter admin's password:
Password:
[root@localhost:~] $

where admin is my user for NA and localhost the server ip address used to access NA, the only requirement is to wrap the command with the single quotation marks.

BR,

Pedro A. Batista
Customer Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the THUMB at the bottom left of the post and show your appreciation.

Hello,

I apologize for taking so long to reply. 

That still did not work unfortunately. Can you think of any settings that could be affecting my ability to do this? I get the same results both on our 10.11 box and our 10.20 box

0 Likes
Commodore Commodore
Commodore

Maybe an overlooked question on my part, but were you able to log in interactively and see an NA> prompt? If you can't, there must be other issues to solve first.

For example, I can't ssh from my cygwin *Nix* on my PC to the CLI (NA>), but I can connect using Putty.

HTH,

0 Likes

Hello,

Yep, I'm able to get to the NA> prompt from the same box. Please see the attached image for an example of the output that I get. I logged into the proxy first and ran the command 'show version', and then I logged out and tried running show version again except non-interactively that time, and that's when I got the exec request failed on channel 0 message.

naexample.png

 

0 Likes
Commodore Commodore
Commodore

Please use single quote in 'show version' as indicated by Pedro_B_NA.

0 Likes

I still get the same results unfortunately

0 Likes
Commodore Commodore
Commodore

Is your installation on a Linux server? Does it work OK from the NA server? I have no problem running on the NA's Linux server. This can be the SSH/OpenSSL installation on the client you use to connect to HPE NA proxy.

0 Likes

Hi,

Sorry for taking so long to reply, but what linux distro/version are you using? I tried ssh'ing in directly from the linux shell, but I still get the same response. This is on a test machine using suse. 

0 Likes
Lieutenant Commander Lieutenant Commander
Lieutenant Commander

Hello,

I see the same behaviour on NA 10.11.01

it seems NA proxy doesn't support SSH exec request functionality.  This method is used when command is like:

ssh admin@localhost -p 8022 "show version"

 

During iteractive session commands are sent using different SSH function - terminal shell. These commands should work fine:

echo -ne "show version \n quit" |  ssh admin@localhost -p 8022

 or

 

 ssh admin@localhost -p 8022 <<< "show version
> quit"

 

 

Please let me know if this solution works for you

View solution in original post

0 Likes

Thanks! That did the trick.

Sorry about taking so long to reply.

0 Likes
Commander Commander
Commander
Hello - Need help urgently. Is there a way, i could connect to HP NA Proxy / CLI directly ???

Currently, i do connect to a device through CLI from NA console and type exit to access the NA CLI. Was just curious to access it directly...

Requesting your immediate help..
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.