Difference between revisions of "How to Transfer Files"

From Statistics Cluster
Jump to navigation Jump to search
(Created page with "== How to Transfer Files == A safe way to transfer files to and from the cluster to a personal computer is to use the [http://linux.die.net/man/1/scp scp] (Secure Copy) comma...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== How to Transfer Files ==
 
== 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 [http://linux.die.net/man/1/scp scp] (Secure Copy) command.
 
A safe way to transfer files to and from the cluster to a personal computer is to use the [http://linux.die.net/man/1/scp scp] (Secure Copy) command.
  
Line 13: Line 14:
 
<pre>
 
<pre>
 
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt /path/to/new/local/location/
 
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt /path/to/new/local/location/
 +
</pre>
 +
 +
=== 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:
 +
<pre>
 +
local machine -> intermediate UConn machine -> stats.phys.uconn.edu
 +
</pre>
 +
 +
The first step before being able to transfer files is to set up port forwarding in a separate terminal
 +
<pre>
 +
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
 +
</pre>
 +
 +
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:
 +
<pre>
 +
Terminal 2:
 +
scp -P 9999 /path/to/local/file.txt <stats username>@localhost:/path/to/stats/file.txt
 +
</pre>
 +
 +
To transfer from stats to a local machine:
 +
<pre>
 +
Terminal 2:
 +
scp -P 9999 <stats username>@localhost:/path/to/stats/file.txt /path/to/local/file.txt
 
</pre>
 
</pre>
  
 
== For Windows Users ==
 
== For Windows Users ==
  
For Windows users it may be useful to download the program [http://www.cygwin.com/ Cygwin]. This is a Windows version of a terminal that has the capability to ssh and scp. Using this program scp will look like the following
+
For Windows users it may be useful to download the program [http://www.cygwin.com/ 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
 
*Transferring to the cluster
 
<pre>
 
<pre>
scp /cygdrive/c/Users/<username>/My\ Documents/path/to/file.txt username@stats.phys.uconn.edu:/path/to/remote/location
+
scp /cygdrive/c/Users/<personalUsername>/My\ Documents/path/to/file.txt  
 +
username@stats.phys.uconn.edu:/path/to/remote/location
 
</pre>
 
</pre>
  
 
*Transferring from the cluster
 
*Transferring from the cluster
 
<pre>
 
<pre>
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt /cygdrive/c/User/<username>/My\ Documents/path/to/local/location
+
scp username@stats.phys.uconn.edu:/path/to/remote/file.txt  
 +
/cygdrive/c/User/<personalUsername>/My\ Documents/path/to/local/location
 
</pre>
 
</pre>
 +
 +
== Graphical Programs ==
 +
Some users prefer to use a program with a graphical user interface (GUI) instead of the commandline. <b>Use these at your own risk</b>. In the past a student tried using such a program and lost all of the files being transferred.

Latest revision as of 18:48, 18 October 2016

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

Graphical Programs

Some users prefer to use a program with a graphical user interface (GUI) instead of the commandline. Use these at your own risk. In the past a student tried using such a program and lost all of the files being transferred.