25.1 Basics of SSH

All of the PEcAn remote infrastructure depends on the system ssh utility, so it’s important to make sure this works before attempting the advanced remote execution functionality in PEcAn.

To connect to a remote server interactively, the command is simply:

ssh <username>@<hostname>

For instance, my connection to the BU shared computing cluster looks like:

ssh ashiklom@geo.bu.edu

It will prompt me for my BU password, and, if successful, will drop me into a login shell on the remote machine.

Alternatively to the login shell, ssh can be used to execute arbitrary code, whose output will be returned exactly as it would if you ran the command locally. For example, the following:

ssh ashiklom@geo.bu.edu pwd

will run the pwd command, and return the path to my home directory on the BU SCC. The more advanced example below will run some simple R code on the BU SCC and return the output as if it was run locally.

ssh ashiklom@geo.bu.edu Rscript -e "seq(1, 10)"