dev-guides

SSHing into SPOC

Basic Access to SPOC

You may log in to SPOC through any terminal application that has access to an SSH client. To connect to SPOC, you can use:

[local-computer]$ ssh <UNI>@spoc.cs.columbia.edu

Setting Up SSH Keys

Are you tired of entering your password to log into SPOC? If so, you’ll want to set up your SSH keys so that you can authenticate without a password. This is highly recommended.

First, if you haven’t already, generate an Ed25519 key pair on your host machine and add it to your ssh-agent following this excellent guide by GitHub. And while you’re at it, add your key to your GitHub account. This is necessary for authenticating with GitHub since it no longer supports authenticating over HTTPS.

Now that you have a public key, you can pass it to SPOC to authenticate logins from your local machine. Assuming that you named your Ed25519 key pair id_ed25519 (the default), run the following command:

[local-computer]$ ssh-copy-id <UNI>@spoc.cs.columbia.edu

At this point, you’ll be able to SSH into SPOC without being prompted for your password.

If you’re interested in GitHub SSH authentication, you’ll want to forward your host’s SSH credentials to SPOC. This enables you to authenticate with GitHub without entering your password or copying your private key.

First, let’s create our SSH config file if we haven’t already:

[local-computer]$ mkdir -p ~/.ssh
[local-computer]$ touch ~/.ssh/config

Here are two configuration options that you can put in ~/.ssh/config using your favorite text editor:

Specific Rule (Recommended)

Host spoc
    HostName spoc.cs.columbia.edu
    User <UNI>
    ForwardAgent yes
    AddKeysToAgent yes

Blanket Rule (Not recommended)

Host *
    ForwardAgent yes
    AddKeysToAgent yes

This says that for any host you SSH into successfully, forward your credentials. Note that if you decide to do this, you should be careful to only SSH into trusted machines. We avoid having to deal with specifying the target machine’s information by applying this blanket rule.

After adding one of the two above configurations, you’ll then be able to SSH into SPOC with the following shorter command:

[local-computer]$ ssh spoc

Alternatively, if you don’t want to deal with SSH configurations, you may simply generate a new SSH key inside SPOC. Be sure to add that key to your GitHub profile.

You can test your GitHub connection with the following command:

[spoc]$ ssh -T git@github.com

Using Visual Studio Code (Optional)

If you’re a fan of Visual Studio Code (VS Code), you can work on your VM directly from a VS Code window on your host machine, allowing you to take advantage of all of VSCode’s features (such as quickly opening any file without navigating directories using Ctrl + P, in a local-quality development experience. Take a look at our VSCode guide for more information.