You can connect to OSC with SSH if you have a bash shell on your machine, either natively with a Mac or Linux machine, or via WSL, Git Bash, or another application on Windows.
The regular way to do this is typing ssh <username>@pitzer.osc.edu
and then providing your password, which can get tedious. There are two setup steps you can take to make this quicker:
Avoid being prompted for your password.
Set up a shortcut for your SSH connection name.
A third thing you can do below, assuming you have VS Code installed locally, is to get it to SSH tunnel to OSC: this will be as if you have VS Code open in OnDemand, but then not in your browser!
These steps are similar to what you did for your SSH Github authentication.
$ ssh-keygen -t rsa
When you’re prompted for a passphrase, you can just press enter if you are okay with not having a passphrase.
If you do want a passphrase, you have to take an extra step to not be prompted, after step 3 below:
$ ssh-add
# (Then here, don't enter a passphrase in any case!)
# Replace <user> by your username, e.g. "jelmer@owens.osc.edu"
$ cat ~/.ssh/id_rsa.pub | ssh <user>@owens.osc.edu 'mkdir -p .ssh && cat >> .ssh/authorized_keys'
$ chmod 700 .ssh; chmod 640 .ssh/authorized_keys
See also this Tecmint post in case you’re struggling, and Buffalo Chapter 4 page 59-60.
These two steps should both be done on your local machine.
~/.ssh/config
:$ touch ~/.ssh/config
Host <arbitrary-alias-name>
HostName <remote-name>
User <user-name>
For instance, I have something along these lines for Pitzer and Owens:
Host op
HostName pitzer.osc.edu
User jelmer
Host oo
HostName owens.osc.edu
User jelmer
Now, you just need to use your, preferably very short, alias to log in:
$ ssh op
This shortcut will also work with scp
and rsync
!
$ rsync ~/scripts op:/fs/ess/PAS1855/scripts
If you want to use VS Code to write code, have a shell, and interact with files at OSC directly, you don’t need to use the VS Code Server from OSC OnDemand. You can also “SSH tunnel” in with your local installation. This is a more convenient way of working because it’s quicker to start up and you are not working inside a browser (which, among other things, takes away screen space and interferes with some keyboard shortcuts).
The set-up is pretty simple (see also these instructions if you get stuck), just recall to do this in your local installation of VS Code, assuming you have one.
Install the VS Code “Remote Development extension pack” by opening up the Extensions side bar, searching for it there, and then clicking “Install”.
Open up the Command Palette (F1 or Ctrl+ShiftP) and start typing “Remote SSH”. Then, select Remote-SSH: Connect to Host…
and specify your SSH connection: e.g. ssh jelmer@pitzer.osc.edu
(you’ll have to do this separately for Pitzer and Owens if you want to be able to connect to either).
With the above setup, you shouldn’t be prompted for a password and VS Code will connect to OSC!
If you’re asked about the operating system of the host, select Linux, which is the operating system of the OSC clusters.
Now, if you open a shell or try to open a file, you are interacting with the OSC file system and not your local computer.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".