Connecting to Metworx via SSH and uploading/downloading files from workflow via ssh protocols

1. Summary

This document walks through connecting to Metworx workflow via ssh, and several common scenarios to upload files to/from Metworx workflows.
It is assumed that the user have previously generated public/private key pair to be used for authentication. Generating the key ssh key pairs is described here

2. Connecting to a Metworx Workflow with SSH

For security reasons, authentication via ssh protocols is restricted to private/public keys, and password authentication is not allowed.
To authenticate, the user must provide a private key for authentication, and contents of a corresponding ssh public key must be on the Metworx workflow, in the users home directory .ssh/authorized_keys file.

To determine the username and hostname of workflow to connect to, click on the workflow name on Metworx Dashboard 2021 07 04 14 46 26 and make a note of Username and Hostname 2021 07 04 14 47 14 . Again, you must have a private key that goes with the public key that is already on the Workflow in the ~/.ssh/authorized_key file.

2.1. Connecting via SSH from a Windows Workstation

On windows, a program called Putty can be used. It is assumed that Putty application is already installed on the Windows workstation and these are the steps to connect

  1. Open Putty application. It will take you to the new session screen.
  2. For hostname, paste or type in hostname noted in a previous step 2021 07 04 14 52 06
  3. Under Auth section of configuration, specify the full path to the private ssh key file 2021 07 04 14 53 47
  4. Click on "Open" to connect. When connecting to a host for a first time, you maybe alerted to accept the new servers host key -- just accept the warning. 2021 07 04 14 55 14
  5. When asked, specify the username. 2021 07 04 14 55 48

2.2. Connecting via ssh from a Linux Server

To ssh from a linux server to Metworx workflow, ssh command can be used Where: username: sergeyn hostname:

% ssh -l sergeyn 
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:6q6GLcSjPexrrOgyrncfMMCDrVKxXhre0qSCm9KofdM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ',' (ECDSA) to the list of known hosts.

Please note, it is assumed that the private ssh key file is in default location of ~/.ssh/id_rsa (the file was created in a previous step)

3. Uploading/Downloading files to Metworx Workflow

3.1. Windows Workstation

On windows, you can use WinSCP application to copy files between your workstation to your workflow.

  1. Open the WinSCP and and fill in hostname and username (leave password blank) 2021 07 04 15 10 45 . Leave other fields as default (i.e. SCP protocol)
  2. Click on Advanced, and, in a screen that comes up, click on Authentication. Specify a full path to the private key file, and click OK. 2021 07 04 15 14 27
  3. Click Log in.
  4. If a warning comes up about new host, accept it. You should now get a screen on which you can copy files between local and remote by dragging them right-clicking on the files. 2021 07 04 15 17 22

3.2. Linux

ON linux, scp command is commonly used to upload and download files. To copy file.txt from a local current directory to /tmp on the Metworx workflow, you would run the following command on the local server:

 % scp file.txt  
file.txt                                                                                                                                      100% 1690   205.2KB/s   00:00    

To copy entire /data/proj1 directory on the Metworx workflow to the current directory on the local unix server, you would run the following on the linux server

scp -pr . 

-pr options specifies to copy directory recursively AND preserves the timestamps on all files.