# File Transfer FC

The File Transfer Function Component enables files to be copied securely to remote machines. The design and implementation uses the RXA toolkit v2.2 to connect to remote machines and execute the secure copy.

The File Transfer CLFC has the ability to connect to remote machines using any of the following protocols: SSH or Windows. You can select which of the protocols will be used, however, if left to the default value of 'ANY', the FC will attempt to connect to the remote machine using each of the available protocols one-by-one until a successful connection is made.

You will need to provide information about the remote machine including hostname, username and password. You have the option of providing a keystore name and passphrase instead of using a password for authentication.

Note:
SSH Connections are typically associated with Linux/UNIX and z/OS hosts. However, by installing Cygwin and the Cygwin openssh package on the Windows target machine the SSH protocol can be used with those targets as well. In addition, z/OS targets can be reached using the SSH protocol also.

## Configuration

Target Machine Hostname
  The hostname (address) of the target machine.
Remote User
  The name of a user with Administrative privileges on the target machine.
Password
  The password for the user (specified as Remote User) on the target machine. This parameter may be optional in the case of SSH connections using a keystore.
Keystore Path
  Full path to the file containing the keystore. This parameter is optional.
Passphrase
  The passphrase that protects your private key, in the keystore specified by the Keystore Path parameter above.
Connection Protocol
  Select from 'ANY', 'SSH', and 'WIN'. This designates what protocol to use when connecting to the remote machine. See Using the FC for more details.
Port
  The port to use to connect to the target machine.
Source file (local)
  The path to the file on the local system that is to be copied. This is overridden if an input attribute 'source.file' has been provided.
Destination directory (remote)
  The path to a destination directory on the target where you want the source file, designated by Source file (local), to be copied. This is overridden if an input attribute 'destination.directory' has been provided.
Detailed Log
  Enabling this will generate debug log messages.

## Function Component Input

Some of the parameters configured in the Configuration screen of the File Transfer FC can be provided as Attributes mapped from the work Entry in the Output Map. When present and non-empty, they take precedence over the parameters in the Configuration screen:

source.file
  This attribute, of type java.io.String, represents the path to the file on the local machine that is to be copied.
destination.directory
  This attribute, of type java.io.String, represents the path where the transferred file should be stored on the remote machine.

In other words, if an attribute called source.file is provided in the input entry object then any source file that was entered in the Config Editor will be disregarded. This allows you to call the File Transfer FC repeatedly by other components in the AssemblyLine to perform different file transfers.

## Using the FC

The File Transfer FC may be used within an AssemblyLine containing other TDI components such as Connectors and other Function Components. To function correctly, you must configure the File Transfer FC correctly using the Config Editor. When it is initialized it will establish a connection with the remote machine and then when its `perform()` method is called (normally when it is reached in the AssemblyLine it is part of), it will transfer the source file to the target directory.

### Configuring the Target System

The target machines must satisfy the following requirements:

Windows Targets
  Using the WIN protocol: Windows XP targets must have Simple File Sharing disabled for Remote Execution and Access to work. Simple Networking forces all logins to authenticate as "guest". A guest login does not have the authorizations necessary for Remote Execution and Access to function.

  To disable Simple File Sharing, you need to start Windows Explorer and click Tools->Folder Options. Select the View tab, scroll through the list of settings until you find Use Simple File Sharing. Remove the check mark next to Use Simple File Sharing, then click Apply and OK.

  Windows XP includes a built-in firewall called the Internet Connection Firewall (ICF). By default, ICF is disabled on Windows XP systems, except on Windows XP Service Pack 2 where it is on by default. If either firewall is enabled on a Windows XP target, it will block attempted accesses by Remote Execution and Access. On Service Pack 2, you can select the File and Printer Sharing box in the Exceptions tab of the Windows Firewall configuration to allow access.

  The target machine must have remote registry administration enabled (which is the default configuration) in order for Remote Execution and Access to run commands and execute scripts on the target machine.

  The default hidden administrative disk shares (such as C$, D$, etc) are required for proper operation of Remote Execution and Access.

UNIX and Linux Targets
  Using the SSH protocol: The RXA toolkit this FC uses does not supply SSH code for UNIX machines. You must ensure SSH is installed and enabled on any target you want to access. OpenSSH 3.71, or higher, contains security enhancements not available in earlier releases.

  RXA cannot establish connections with any UNIX target that has ssh remote access protocol disabled.

  In order for RXA to communicate with Linux and other SSH targets using password authentication, you must edit the file /etc/ssh/sshd_config file on target machines and set:

      PasswordAuthentication yes (the default is 'no')

  After changing this setting, stop and restart the SSH daemon using the following commands:

      /etc/init.d/sshd stop
      /etc/init.d/sshd start

  For further details on how to configure SSH between the local machine and the target, either using password authentication or a keystore, please refer to the relevant OpenSSH documentation at http://www.openssh.com .