Introduction
This is the sixth in a series of articles describing how to get started with using the the JADE Client via its Command Line Interface.
The articles in this series are:
- Getting Started and Downloading files
- Simple File Selection
- More Advanced File Selection
- File Transfer
- Checking files for completeness
- Public / Private Key Authentication
Public / Private Key Authentication with SFTP
In addition to the password authentication described for FTP and SFTP in the first article in this series JADE can use Public/Private Key Authentication.
Public/private key authentication
We assume here that users are familiar with the concepts of public/private key authentication.
To use public/private key authentication instead of password authentication the *_ssh_auth_method parameter is set to:
- _ssh_auth_method = publickey
and the *_user parameter is replaced with path of the private key file:
- *_ssh_auth_file = C:\Users\myUserName\.ssh\demo_id_rsa
Example
- Download the private key demo_id_rsa for the demo user (demo_id_rsa). For your information the public key demo_id_rsa.pub is available and is already installed on our file transfer test system.
- Save the public key in the jade_demo folder alongside the jade_settings_windows.ini file.
- Ensure that the path to this file is iidentical to the value for the source_ssh_auth_file parameter listed in the profile below.
Users of a Windows-Unix compatibility software such as Cygwin may prefer to use the location specified in the commented out source_ssh_auth_file parameter:- For Windows users:
- %USERPROFILE%\.ssh\demo_id_rsa
where %USERPROFILE% is the path to your Windows user home directory.
- %USERPROFILE%\.ssh\demo_id_rsa
- For Unix users:
- ${HOME}\.ssh\demo_id_rsa
where ${HOME} is the path to your user's home directory.
- ${HOME}\.ssh\demo_id_rsa
- For Windows users:
- Ensure that the path to this file is iidentical to the value for the source_ssh_auth_file parameter listed in the profile below.
- The profile listed below can be called from the jade_settings_windows.ini file.
This profile is identical to the SFTP password profile described at the start of this article, with the exception of the parameters required for public/private key authentication.
[sftp_server_2_local_key] ;; operation = copy file_spec = ^test\.txt$ ;; source_host = test.sos-berlin.com source_protocol = sftp source_port = 22 source_user = demo source_ssh_auth_method = publickey source_ssh_auth_file = ${USERPROFILE}\jade_demo\demo_id_rsa source_dir = / ;; target_host = localhost target_protocol = local target_dir = ${USERPROFILE}\jade_demo\a
Call the profile using:
jade.cmd -settings="%USERPROFILE%\jade_demo\jade_settings.ini" -profile="sftp_server_2_local_key"
Behavior
Running the profile will cause the test.txt file to be downloaded after authentication has succeeded.
The connection will be
ended after the download has been completed.