Using the FTP Definition Type
The FTP process type allows you to specify jftp commands in a process, which can then be executed on platform agents. The same process can be used across platforms without the need adapt the syntax to the target platform.
The following default FTP processes allow you to perform basic actions:
Name | Description |
---|---|
System_FTP_delete | Delete a file from the remote server |
System_FTP_get | Get a file from the remote server |
System_FTP_list | List a directory on the remote server |
System_FTP_mget | Retrieve files matching a pattern from the remote server |
System_FTP_mkdir | Create a directory on the remote server |
System_FTP_mput | Upload files matching a pattern to the remove server |
System_FTP_put | Upload a file to the remote server |
System_FTP_rmdir | Remove a directory on the remote server |
Security
The RunAsUser property of the process is used to launch jftp
. The default user of the platform agent will be used if it is not set.
The RemoteRunAsUser property of the process will be used to connect to the remote FTP server, if it is set. This allows you to use credentials with jftp.
The following process parameters can also be used to specify users:
JCS_USER
- OS user (takes precedence over Run As User )JCS_ENDPOINT
- the endpoint forJCS_USER
JCS_REMOTE_USER
- FTP user (takes precedence over Remote Run As User )JCS_REMOTE_ENDPOINT
- the endpoint forJCS_REMOTE_USER
note
When JCS_USER
, JCS_REMOTE_USER
, JCS_REMOTE_PASSWORD
, or JCS_PASSWORD
contain a password, make sure to set the Password property on the parameter or the password will be stored and displayed in clear text. The password will be encrypted in the Run As User and Remote Run As User fields the next time(s) you edit the process.
note
The process parameters take precedence over the [Remote] Run As User fields. This allows you to have generic credentials, you use JCS_REMOTE_ENDPOINT
when the endpoint in the Run As User field should only be used to find a credential.
The syntax for the Run As User / Remote Run As User fields and JCS_USER
/ JCS_REMOTE_USER
parameters is:
[[{virtual}:]user[[/password][[@endpoint]
You can specify defaults on the process server with process server parameters.
note
The following special characters in passwords will cause problems: @, /, :
Note that JCS_USER
behaves differently on Windows in Redwood Server version 9 than did JCS_NTUSER
in version 7 and earlier; JCS_USER
defaults to local accounts (when no domain is specified) whereas JCS_NTUSER
would default to domain accounts.
Using Credentials
When you use credentials, the connection is already established when the process source is evaluated. This means that you cannot specify a non-standard port in the process source while using credentials, in this case you need to specify the port in the Endpoint of the credential as follows: [{virtual}:]<user>@<endpoint>:<port>
or jdoe@ftp.example.com:2021
.
Examples
The following examples illustrate how to specify users:
JCS_USER
set tojdoe
- alogin
credential forjdoe
must exist for the endpoint specified by the RemoteHostName process server parameter. If the credential does not exist or is not valid (invalid password) the process will fail.JCS_REMOTE_USER
set tojdoe@ftp.example.com
- alogin
credential forjdoe
must exist for endpointftp.example.com
. If the credential does not exist or is not valid (invalid password) the process will fail.JCS_REMOTE_USER
set to{virtual}:ftp_user@ftp.example.com
- alogin
credential for virtual userftp_user
must exist for endpointftp.example.com
; the username of this credential can be set totestuser
in the Test environment,devuser
in the development environment, andjdoe
in the production environment. There is thus no need to change the process when you promote it from one environment to the other. If the credential does not exist or is not valid (invalid password) the process will fail.- Run As User set to
jdoe@MSLN_UNIXS3:sjobs@MSLN_UNIXS3
- first, the credential forjdoe
will be used, if this fails the credential forsjobs
will be used. If both fail, the process will reach error. Note that in this example, the RemoteHostName process server parameter must be set toMSLN_UNIXS3
. - Run As User is set to
jdoe/tiger@MSLN_UNIXS3
- no credential lookup is done, since the password is provided.MSLN_UNIXS3
will note - Another example using multiple parameters:
JCS_USER
is set tojdoe/tiger
JCS_ENDPOINT
is set toMSLN_UNIXS3
Syntax
You can create your own FTP processes using the following syntax:
get <options> <outfile> <infile>
mget <options> <pattern> <localdir>
put <options> <infile> <outfile>
mput <options> <pattern> <remotedir>
list <options> <directory>
delete <options> <file>
mkdir <options> <directory>
rmdir <options> <directory>
quote <options> <command>
include <options> <includefile>
<options> := [ [ -ascii | -binary ] |<p />
-use_cwd |<p />
-pasv |<p />
-port <port_number> |<p />
-secretfile <file> |<p />
<options> ]
Example
Specifying username, password and host (password will appear encrypted once saved)
The Remote Run As User is set to jsmith/htimsj@ftp.example.com
The Source is set to the following:
list pub/shared_cars
Using a credential
The Remote Run As User is set to jsmith@ftp.example.com
The Source is set to the following:
list pub/shared_cars
Retrieving a file
The Remote Run As User is set to jsmith@ftp.example.com
The Source is set to the following:
list pub/shared_cars/
get pub/shared_cars/Application_Example.car /tmp/Application_Example.car
mget pub/shared_cars/JobDefinition_* /tmp/
Additional information and usage examples can be found at: JFTP Documentation.