SCP job fails with "unknown message"

Document ID : KB000008855
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:


We have the following SCP job defined in our WAAE instance.

/* ----------------- SCP_TEST_JOB ----------------- */

insert_job: SCP_TEST_JOB   job_type: SCP
machine:
owner: scpusr@rhel7-I3914
permission:
date_conditions: 0
alarm_if_fail: 0
scp_transfer_direction: UPLOAD
scp_server_name: rhel7-I3914
scp_server_port: 22
scp_remote_dir: "/tmp"
scp_remote_name: "daily_collections.csv"
scp_local_name: "\\\\fileshare\\share2\\daily_collections.csv"
scp_target_os: UNIX
scp_protocol: SCP
scp_local_user: svcacnt@cawa-winagent

When the job is executed, it fails with the following error:

Job Name                                               Last Start                   Last End                    ST/Ex  Run/Ntry   Pri/Xit
________________________________   _________________  _________________  _____ ________  _______
SCP_TEST_JOB                                       10/26/2017 10:54:01 10/26/2017 10:54:04  FA      53464/1    1

  Status/[Event]  Time                 Ntry ES  ProcessTime           Machine
  --------------  --------------------- --  --  --------------------- ----------------------------------------
  STARTING        10/26/2017 10:53:57    1  PD  10/26/2017 10:53:58   cawa-winagent
  RUNNING         10/26/2017 10:54:01    1  PD  10/26/2017 10:54:01   cawa-winagent
    <Executing at WA_AGENT>
  FAILURE         10/26/2017 10:54:04    1  PD  10/26/2017 10:54:05
    <unknown message>


Facts verified:

  • "cawa-winagent" is a MS Windows host with a functional CA WA System Agent 11.3 SP6.
  • Correct passwords for "svcacnt@cawa-winagent" and "scpusr@rhel7-I3914" users are registered in AEDB via the autosys_secure utility.
  • TCP Port 22 is open on the firewall for remote server rhel7-I3914.
  • The UNC \\fileshare\share2\ path is accessible as user "svcacnt@cawa-winagent".
  • "scpusr" user has write access on the /tmp directory on rhel7-I3914 server.
  • We can to connect to remote server rhel7-I3914 and transfer files using WinSCP tool.
Environment:
CA Workload Automation AE 11.3.5 and higher.
Cause:

The cause of the "<unkown message>" is usually an error in or customization of the user's profile (.cshrc, .login, .bashrc, .bash_profile, etc.) files. For non-interactive sessions such as SFTP or SCP, the user's profile must not print anything either explicitly or in error.

 

In this case, the scpusr user's $HOME/.bashrc file on rhel7-I3914 server contains an echo command which caused the SCP to break:

$ id
uid=1000(scpusr) gid=1000(scpusr) groups=1000(scpusr) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
echo -e "Welcome ${USER}!\nYou are entering a secure-zone."


More information about his behavior is documented at the URL below:

https://bugzilla.redhat.com/show_bug.cgi?id=20527

Resolution:

Workaround is to either not echo or print any message in the user's profile file, or add a logic to print the message only when logged in via an interactive shell.

The following have been tested to work:

BASH login profile (~/.bashrc)

$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
 $- == *i*  && echo -e "Welcome ${USER}!\nYou are entering a secure-zone."
 

C Shell login progile (~/.cshrc)

$ cat ~/.cshrc
if($?prompt) then # Only interactive shells set $prompt
    printf "Welcome to ${HOST}.\nYou are entering a secured-zone.\n"
endif