Affects Version/s: None
Fix Version/s: None
Right now SshActionExecutor runs the SCP command as part of executing the SSH action.
As a consequence, if the target SSH user has some command/script in their rc file (e.g. .bashrc) that outputs to the standard output in non-interactive sessions, the action will fail with
UNKOWN_ERROR: Not able to perform operation [scp -o PasswordAuthentication=no -o KbdInteractiveDevices=no -o StrictHostKeyChecking=no -o ConnectTimeout=20 ...
It turns out, it is the way how openssh SCP works. So if something else is written to stdout (for example an ls in .bashrc), it will fail and return 1.
To overcome this limitation, we should investigate alternatives that do not have this limitation.
JSch (https://mvnrepository.com/artifact/com.jcraft/jsch) can be such an alternative.
- Is this shell interactive? https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html
- As a workaround, one could detect in their .bashrc (or the corresponding rc file of the shell they prefer) if they are in an SCP / non-interactive session, do not echo anything on noninteractive shell.
For example, if I put the following into my .bashrc
[[ $- == i ]] || return
SCP will work. But there can be situations where commands must be run. We could silent them (by redirecting stderr/stdout), but I believe it is not so convenient for a lot of users.