Difference between revisions of "SFTP Send"

From Commander4j Wiki
Jump to: navigation, search
(Example 1)
(Installation)
 
(25 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
== SFTP Send ==
 
== SFTP Send ==
  
 +
For support please email support@commander4j.com
  
 
== Installation ==
 
== Installation ==
Line 8: Line 9:
 
Download the appropriate version of the application from SourceForge[https://sourceforge.net/projects/sftp-send/files/]
 
Download the appropriate version of the application from SourceForge[https://sourceforge.net/projects/sftp-send/files/]
  
*Note that the Windows and MacOS version of the application come with their own private Java Runtime bundled as part of the installer. The Linux version of the installer does not have Java included with it and you will need to make sure that you have Java 1.8 or higher available on your machine.
+
Note that the Windows and MacOS version of the application come with their own private Java Runtime bundled as part of the installer. The Linux version of the installer does not have Java included with it and you will need to make sure that you have Java 1.8 or higher available on your machine.
  
 
There is no Graphical User Interface (GUI) for this utility. It can be run from the command prompt / terminal or as a background process.
 
There is no Graphical User Interface (GUI) for this utility. It can be run from the command prompt / terminal or as a background process.
Line 16: Line 17:
 
The two files of interest are sftpSend.xml and email.xml. You only need to edit email.xml if you want the application to send you notifications when files are transferred.
 
The two files of interest are sftpSend.xml and email.xml. You only need to edit email.xml if you want the application to send you notifications when files are transferred.
  
== Example 1 ==
+
== Example 1 (User Password Authentication) ==
  
  
Line 23: Line 24:
 
The example above shows some values for a configuration that would be used to upload files of type *.xml to a remote SFTP server with username and password authentication.
 
The example above shows some values for a configuration that would be used to upload files of type *.xml to a remote SFTP server with username and password authentication.
  
Line 7 is a simple heading and is used both for simple documentation and is also used by the email module as the subject for any emails sent.
+
Line 7 '''title''' is a simple heading and is used both for simple documentation and is also used by the email module as the subject for any emails sent.
  
Line 8 is a simple "true" or "false" switch which either enables or disables the sending of emails by the SFTP Send application.
+
Line 8 '''emailEnabled''' is a simple "true" or "false" switch which either enables or disables the sending of emails by the SFTP Send application.
  
Line 12 is the name of IP Address of the remote host. Note that you can encrypt this information if you want using the "En
+
Line 12 '''remoteHost''' is the name of IP Address of the remote host. Note that you can encrypt this information if you want using the [[SFTP Send Encrypt Utility]]
 +
 
 +
Line 13 '''remotePort''' is the port number to use for the SFTP connection
 +
 
 +
Line 14 '''checkKnownHosts''' is a yes or no switch to determine if the application validates the connection using the ''known_hosts'' file.
 +
 
 +
Line 15 '''knownHostsFile''' is the location of the "known_hosts" file to use.
 +
 
 +
Line 16 '''authType''' can have two possible values "''user password''" or "''user public key''"
 +
 
 +
Line 17 '''username''' can be used with both types of authentication.
 +
 
 +
Line 18 '''password''' only used for "''user password''" authentication
 +
 
 +
Line 19 '''privateKeyFile''' contains the location of the private key file that you want to use. An example linux command line for creating a key pair would be '''ssh-keygen -m pem -f $1''' where '''$1''' should be the filename that you want to create
 +
 
 +
Line 20 '''privateKeyPasswordProtected''' is a "yes" or "no" question
 +
 
 +
Line 21 '''privateKeyPassword'''  if you password protected the private key then this entry will store that password.
 +
 
 +
Line 25 '''localDir''' contains the path to where you intend to place files for uploading. You should end the path with the appropriate path separator for your operating system "/" or "\"
 +
 
 +
<pre style="color: red;">BE VERY CAREFUL YOU SPECIFY THE CORRECT LOCAL PATH - FILES WILL BE REMOVED / DELETED FROM THIS FOLDER ONCE THEY HAVE BEEN SENT</pre>
 +
 
 +
Line 26 '''localFileMask''' is a wildcard mask to allow the program filter those files which are identified for upload. You could for example use "*.xml" or "UPL?????.xml"
 +
 
 +
Line 27 '''backupDir''' if you wish to keep a local backup copy of files before they are uploaded to the remote server then you can specify where this backup folder is using this setting.
 +
 
 +
Line 31 '''remoteDir''' is the path (folder/directory) on the remote server where you want files saved.
 +
 
 +
Line 32 '''tempFileExtension''' if the remote system is processing files as they arrive you can specify a temporary file extension so that the file won't be recognised and processed until it's finished uploading. This assumes that the remote process is also using a wildcard to identify files to process.
 +
 
 +
== Example 2 (Public Key) ==
 +
 
 +
[[File:sftpSend3.jpg|750px]]
 +
 
 +
Most of the settings are the same as in Example 1 above. The settings which are relevant to Public Key authentication as shown below.
 +
 
 +
Line 16 '''authType''' is "user public key"
 +
 
 +
Line 19 '''privateKeyFile''' contains the location of the private key file that you want to use. An example linux command line for creating a key pair would be '''ssh-keygen -m pem -f $1''' where '''$1''' should be the filename that you want to create
 +
 
 +
Line 20 '''privateKeyPasswordProtected''' is a "yes" or "no" question
 +
 
 +
Line 21 '''privateKeyPassword'''  if you password protected the private key then this entry will store that password.
 +
 
 +
 
 +
== Running SFTP Send (Console / Command Line) ==
 +
 
 +
Simply open up a terminal, change into the install folder and run
 +
 
 +
sftpSend_Console
 +
 
 +
You will see output on the screen which shows what is happening.
 +
 
 +
== Running SFTP Send (Windows Service) ==
 +
 
 +
Open a command prompt with admin permissions (Run as Administrator)
 +
 
 +
sftpSend_Service /install SFTP_Service
 +
sc config SFTP_Service displayName= "SFTP Service"
 +
 
 +
From the Windows Services App you can change the startup mode, configure a account to run under for network permissions etc
 +
 
 +
You can also manually stop and start the app from the control panel.
 +
 
 +
To remove the service - stop it running then from a command line (running with admin permissions)
 +
 
 +
sc delete SFTP_Service
 +
 
 +
== Running SFTP Send (Linux Daemon) ==
 +
 
 +
Open a terminal
 +
 
 +
sftpSend_Service /install
 +
 
 +
You can now control the background task using commands like :-
 +
 
 +
sftpSend_Service status
 +
sftpSend_Service start
 +
sftpSend_Service stop
 +
sftpSend_Service restart
 +
 
 +
To uninstall the background service/daemon
 +
 
 +
sftpSend_Service /uninstall

Latest revision as of 19:42, 6 December 2020

SFTP Send

For support please email support@commander4j.com

Installation

Download the appropriate version of the application from SourceForge[1]

Note that the Windows and MacOS version of the application come with their own private Java Runtime bundled as part of the installer. The Linux version of the installer does not have Java included with it and you will need to make sure that you have Java 1.8 or higher available on your machine.

There is no Graphical User Interface (GUI) for this utility. It can be run from the command prompt / terminal or as a background process.

Before running the application you need to configure it by editing 2 xml files which can be found in the xml/config 'subdirectory.

The two files of interest are sftpSend.xml and email.xml. You only need to edit email.xml if you want the application to send you notifications when files are transferred.

Example 1 (User Password Authentication)

SftpSend1.jpg

The example above shows some values for a configuration that would be used to upload files of type *.xml to a remote SFTP server with username and password authentication.

Line 7 title is a simple heading and is used both for simple documentation and is also used by the email module as the subject for any emails sent.

Line 8 emailEnabled is a simple "true" or "false" switch which either enables or disables the sending of emails by the SFTP Send application.

Line 12 remoteHost is the name of IP Address of the remote host. Note that you can encrypt this information if you want using the SFTP Send Encrypt Utility

Line 13 remotePort is the port number to use for the SFTP connection

Line 14 checkKnownHosts is a yes or no switch to determine if the application validates the connection using the known_hosts file.

Line 15 knownHostsFile is the location of the "known_hosts" file to use.

Line 16 authType can have two possible values "user password" or "user public key"

Line 17 username can be used with both types of authentication.

Line 18 password only used for "user password" authentication

Line 19 privateKeyFile contains the location of the private key file that you want to use. An example linux command line for creating a key pair would be ssh-keygen -m pem -f $1 where $1 should be the filename that you want to create

Line 20 privateKeyPasswordProtected is a "yes" or "no" question

Line 21 privateKeyPassword if you password protected the private key then this entry will store that password.

Line 25 localDir contains the path to where you intend to place files for uploading. You should end the path with the appropriate path separator for your operating system "/" or "\"

BE VERY CAREFUL YOU SPECIFY THE CORRECT LOCAL PATH - FILES WILL BE REMOVED / DELETED FROM THIS FOLDER ONCE THEY HAVE BEEN SENT

Line 26 localFileMask is a wildcard mask to allow the program filter those files which are identified for upload. You could for example use "*.xml" or "UPL?????.xml"

Line 27 backupDir if you wish to keep a local backup copy of files before they are uploaded to the remote server then you can specify where this backup folder is using this setting.

Line 31 remoteDir is the path (folder/directory) on the remote server where you want files saved.

Line 32 tempFileExtension if the remote system is processing files as they arrive you can specify a temporary file extension so that the file won't be recognised and processed until it's finished uploading. This assumes that the remote process is also using a wildcard to identify files to process.

Example 2 (Public Key)

SftpSend3.jpg

Most of the settings are the same as in Example 1 above. The settings which are relevant to Public Key authentication as shown below.

Line 16 authType is "user public key"

Line 19 privateKeyFile contains the location of the private key file that you want to use. An example linux command line for creating a key pair would be ssh-keygen -m pem -f $1 where $1 should be the filename that you want to create

Line 20 privateKeyPasswordProtected is a "yes" or "no" question

Line 21 privateKeyPassword if you password protected the private key then this entry will store that password.


Running SFTP Send (Console / Command Line)

Simply open up a terminal, change into the install folder and run

sftpSend_Console

You will see output on the screen which shows what is happening.

Running SFTP Send (Windows Service)

Open a command prompt with admin permissions (Run as Administrator)

sftpSend_Service /install SFTP_Service sc config SFTP_Service displayName= "SFTP Service"

From the Windows Services App you can change the startup mode, configure a account to run under for network permissions etc

You can also manually stop and start the app from the control panel.

To remove the service - stop it running then from a command line (running with admin permissions)

sc delete SFTP_Service

Running SFTP Send (Linux Daemon)

Open a terminal

sftpSend_Service /install

You can now control the background task using commands like :-

sftpSend_Service status sftpSend_Service start sftpSend_Service stop sftpSend_Service restart

To uninstall the background service/daemon

sftpSend_Service /uninstall