Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-2638

Ssh action fails if .bashrc contain a script

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      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.

      See https://github.com/apache/oozie/blob/master/core/src/main/java/org/apache/oozie/action/ssh/SshActionExecutor.java#L695

      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.

      References:

      • 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                asasvari Attila Sasvári
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: