What could be causing the message "exec request failed on channel 0" to appear
I'm trying to send an ssh command non-interactively to an HP automation server's proxy, and while I can ssh in and enter it interactively perfectly fine, I always get the message "exec request failed on channel 0" when attempting to send the command over non-interactively. Is there anything that I could change on the client side to allow me to send the command over? There's not much that I can change on the server side.
Apparently it's possible, but I just can't get it working on my install (see link: https://community.hpe.com/t5/Network-Automation-Practitioners/Is-there-a-way-to-issue-a-command-to-an-NA-proxy-using-SSH-non/m-p/6935003/highlight/false#M2821)
In case it would help, here are the version details for my OS and openssh version:
OpenSSH_7.2p2, OpenSSL 1.0.2j-fips 26 Sep 2016
NAME="openSUSE Leap"
VERSION="42.2"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="42.2"
PRETTY_NAME="openSUSE Leap 42.2"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:42.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
Thank you
The server is allowing you to open an interactive shell but not the exec
system call to execute a command without a pseudo-terminal. Use the -t
switch as follows to force pseudo-terminal allocation.
ssh [email protected] -p 8022 -t show version
Alternatively, use expect
to script an interaction with the remote endpoint. See this answer for an example.
References:
- man ssh
- man expect
expect
home page