SSH, PyCharm, and VS Code

Saturn provides SSH access into Jupyter instances, which means you can also connect PyCharm and VS Code

SSH

SSH access provides alternatives to Jupyterlab for working with your projects. In order to access a server via SSH, a public key must first be added for your user.

Adding SSH Public Keys

From the dashboard sidebar, select “Credentials”, then click the + in the upper right to add a new credential. Select “SSH Public Key” from the type list, choose a name, and paste in an openssh-formatted public key. If you do not yet have a public key, follow the instructions here to create a keypair, and copy the public key into the text box, as shown below.

Note that some key generation tools (such as PuTTY) may generate public keys in various formats - the public key here must be in openssh format.

Enable SSH for the Jupyter Server

If the server already exists, click its name from the server list to edit its details (if it is running, it must first be stopped). Under Advanced Settings, check the checkbox labeled “Enable SSH Access”. Click Save, then start the server.

Create or Update the Jupyter Server

If the server was already running before your key was added, it will need to be stopped and restarted to pick up the newly-created key.

Connecting to the Server

Many tools should be compatible with this functionality. Below are instructions for some popular options. For all options, the SSH URL is found in the server’s details:

Note that this URL may change if the server is stopped, including auto-shutoff

Terminal

Using the terminal application of your choice, the server can be accessed via:

ssh <server URL>

If your key is not added to your ssh agent (or no ssh agent is running), the key can be manually specified:

ssh -i path/to/key <server URL>

PyCharm

To set up PyCharm to connect to a running Jupyter server, follow Jetbrains’ instructions here: https://www.jetbrains.com/help/pycharm/creating-a-remote-server-configuration.html. Choose SFTP for the credentials type and create a new SSH configuration. Use the following values:

Host: The hostname from the Jupyter Server details (see screenshot above) - remove joyvan@ .

Port: 22

User name: jovyan

Authentication type: Key pair

Private key file: Path to your private key

Passphrase: The passphrase to your key, if you set one

Once the new server configuration has been added, navigate to Tools > Deployment > Remote Host. Fprom the new panel this opens, select the new server configuration you just created. This will let you browse the contents of the server, and edit the files in place. Your project is located at /home/jovyan/project . From Tools > Start SSH Session… a terminal can be opened to run commands.

Visual Studio Code (VS Code)

Using the Remote - SSH plugin, VS Code can connect to the Jupyter Server instance directly. To set this up, following their instructions: https://code.visualstudio.com/docs/remote/ssh

To make configuration easy, it is suggested to add an entry to your ~/.ssh/config file (create it if it doesn’t exist):

Host myjupyter
    HostName <your server hostname>
    User jovyan
    IdentityFile path/to/your/key

Update the name above to match your server as you see fit. Then, from the command pallette (Ctrl+Shift+P or Cmd+Shift+P, depending on OS), select Remote-SSH: Connect to host…, then select your config entry (created above) from the list. Once opened, select “Open Folder”, then choose /home/jovyan/project . The project’s files can be opened directly, and bash is available if you would like to open a terminal through VS Code.