Difference between revisions of "HOWTO copy a file from the ifarm to home"

From GlueXWiki
Jump to: navigation, search
(Created page with "Let us assume that you want to copy the file /cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root from...")
 
m (Marki moved page Copying files to home to HOWTO copy a file from the ifarm to home: Make the title appropriate for the HOWTO page.)
 
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
  /cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root
 
  /cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root
  
from the lab to home. For this example we start with a shell variable definition to save typing:
+
from the ifarm to home. For this example we start with a shell variable definition to save typing:
  
 
  file=/cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root
 
  file=/cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root
Line 19: Line 19:
 
  ssh -t -L${port}:localhost:${port} $user@login.jlab.org ssh -t -L${port}:localhost:22 ifarm
 
  ssh -t -L${port}:localhost:${port} $user@login.jlab.org ssh -t -L${port}:localhost:22 ifarm
  
you will have to type your JLab password twice (unless you are using an ssh agent).
+
you will have to type your JLab password twice (unless you are using an ssh agent). Leave the tunnel running.
  
 
=== 2. Use the tunnel to copy the file ===
 
=== 2. Use the tunnel to copy the file ===
  
scp -P$port localhost:$file .
+
In a '''different terminal''' use the scp command
  
to copy to the current working directory.
+
scp -P$port $user@localhost:$file .
 +
 
 +
to copy to the current working directory (note the "." at the end of the command). You will have to supply your JLab password.

Latest revision as of 20:03, 9 April 2021

Let us assume that you want to copy the file

/cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root

from the ifarm to home. For this example we start with a shell variable definition to save typing:

file=/cache/halld/RunPeriod-2017-01/analysis/ver44/tree_pi0pippimeta__B5_M7_M17/merged/tree_pi0pippimeta__B5_M7_M17_030648.root

We will assume bash throughout. You will also need a port number, something random between 10000[?] and 65000[?]. We will choose

port=12345

The randomness is to avoid conflicts with other users. And let us assume your JLab username is

user=janedoe

1. Set up an ssh tunnel

ssh -t -L${port}:localhost:${port} $user@login.jlab.org ssh -t -L${port}:localhost:22 ifarm

you will have to type your JLab password twice (unless you are using an ssh agent). Leave the tunnel running.

2. Use the tunnel to copy the file

In a different terminal use the scp command

scp -P$port $user@localhost:$file .

to copy to the current working directory (note the "." at the end of the command). You will have to supply your JLab password.