Skip to main content

CLI SSH Connecting to Running Jupyter

Information expiration reminder

If you are running Jupyter You can see the following image in the workspace "SSH visit" information. Explain your Jupyter The workspace now supports new SSH The connection method has been established. No need for remote login in this way. Detailed documentation can be referred to adopt SSH Connecting to Running Jupyter implement.

Function Introduction

HyperAI Support through SSH Protocol to access running Jupyter Execution of types. By completing the following steps, it can be achieved SSH Visited:

  1. towards HyperAI Upload personal information SSH Public key
  2. Add locally HyperAI SSH Access configuration
  3. By command ssh <running-jupyter-id>.gear realization SSH Sign in
note

Only in operation "Jupyter working space" Only then can it pass SSH Protocol Access.

Prepare public key

Generate public key

Open command line input ssh-keygen -m PEM -t rsa -b 4096 -C "your.email@example.com" (My own email) , Continuous clicks Enter Can generate a key pair. Windows User recommended adoption PowerShell Perform this step.

ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter] // Recommend using default address
Enter passphrase (empty for no passphrase): //Click here Enter Just press the key. You can also fill in the password. After filling in the password, use it every time SSH When pushing code, it will require a password to be entered. Due to this Key Not for military purposes either. So there's no need to set a password either
note

If you are very familiar with this part, you can follow the usual process of creating a public key. For more information, please refer to generate SSH Public key.

After success, the following information will be displayed:

Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your.email@example.com

Add public key

  1. open ~/.ssh catalogue (Windows Below is the user directory .ssh catalogue), Open in Editor id_rsa.pub file (This is the default name for generating the public key. If a different name is used when generating the public key. Simply open the corresponding file), Copy all content.
  2. Sign in HyperAI page. Click on the left navigation bar on the interface "SSH set up" -> "Add new public key" , Paste the content into "Public key" In the text box and give yourself this SSH Name the public key. Click to add SSH Public key is sufficient.

Create and upload using command-line tools SSH Public key

If you don't have any public keys locally. It can be done through commands bayes ssh create Complete the creation and upload of the public key. If you already have a name locally called ~/.ssh/id_rsa.pub The public key, adopt bayes ssh upload ~/.ssh/id_rsa.pub You can complete the upload of the public key.

note

stay install bayes Command line tools understand bayes Installation method of command-line tools.

Initialize local SSH to configure

After adding the completed public key to HyperAI Additional settings need to be added locally later. This part is done through command-line commands:

bayes ssh init

It can be completed.

Login to run Jupyter implement

First, open one Jupyter implement. When the execution is in "Running" After the state. By command

ssh <jupyter-job-id>.gear

The connection can be completed.

among <jupyter-job-id> It refers to the current situation "implement" of id. Can be obtained on the page:

Adopt VS Code SSH connect

If it is through SSH Remote connection in operation Jupyter environment. Firstly, please read VS Code Related documents Remote Development using SSH understand VS Code Support for this aspect. And install the corresponding plugins.

  1. First, click on the bottom left corner. Open remote window.

  2. Select in the command panel "Connect to Host..." And enter the car.

  3. input root@jupter-job-id.gear, Pay attention to jupyter-job-id Partially replace with the ones that need to be connected Jupyter The container's id. Here I am id yes iay6ih7xrgal.

  4. from "Container Overview" You can see the execution of the run and its id.

VS Code A new window will pop up and prompt that the connection has been successful. The directory it currently points to is /root instead of HyperAI The default working directory used. Click on the left column "open a folder" Switch to /hyperai/home You can see the contents of the directory now.