How to Transfer Files

From Statistics Cluster
Revision as of 18:46, 18 October 2016 by Barnes (talk | contribs)
Jump to navigation Jump to search

How to Transfer Files

Both machines are on the UConn network

A safe way to transfer files to and from the cluster to a personal computer is to use the scp (Secure Copy) command.

The basic form of scp is

  • Transferring to the cluster
scp /path/to/local/file.txt username@stats.phys.uconn.edu:/path/to/new/remote/location/
  • Transferring from the cluster
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt /path/to/new/local/location/

Transferring to/from offsite

Sometimes it is necessary to transfer files between your local machine and stats. This can become complicated if the local machine is not on the UConn network. In this case the connection is:

local machine -> intermediate UConn machine -> stats.phys.uconn.edu

The first step before being able to transfer files is to set up port forwarding in a separate terminal

Terminal 1:
ssh -L9999:stats.phys.uconn.edu:22 <username for intermediate machine>@<hostname of intermediate machine>

Ex: ssh -L9999:stats.phys.uconn.edu:22 TestUser@MiddleMachine.uconn.edu

Once the port forwarding has been set, files can be transferred between the two endpoints. To transfer a file from a local machine to stats:

Terminal 2:
scp -P 9999 /path/to/local/file.txt <stats username>@localhost:/path/to/stats/file.txt

To transfer from stats to a local machine:

Terminal 2:
scp -P 9999 <stats username>@localhost:/path/to/stats/file.txt /path/to/local/file.txt

For Windows Users

For Windows users it may be useful to download the program Cygwin. This is a Windows version of a terminal that has ssh and scp capability as well as many others. Using this program scp will look like the following

  • Transferring to the cluster
scp /cygdrive/c/Users/<personalUsername>/My\ Documents/path/to/file.txt 
username@stats.phys.uconn.edu:/path/to/remote/location
  • Transferring from the cluster
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt 
/cygdrive/c/User/<personalUsername>/My\ Documents/path/to/local/location