26.4 SSH tunnels and PEcAn

Many of the PEcAn.remote functions assume that a tunnel is already open. If working from the web interface, the tunnel will be opened for you by some under-the-hood PHP and Bash code, but if debugging or working locally, you will have to create the tunnel yourself. The best way to do this is to create the tunnel first, outside of R, as described above. (In the following examples, I’ll use my username ashiklom connecting to the test-pecan server with a socket stored in /tmp/testpecan. To follow along, replace these with your own username and designated server, respectively).

ssh -nNf -o ControlMaster=yes -S /tmp/testpecan ashiklom@test-pecan.bu.edu

Then, in R, create a host object, which is just a list containing the elements name (hostname) and tunnel (path to tunnel file).

my_host <- list(name = "test-pecan.bu.edu", tunnel = "/tmp/testpecan")

This host object can then be used in any of the remote execution functions.