Adopt SSH Connecting to Running Jupyter working space
Function Introduction
HyperAI Support through SSH Protocol to access running Jupyter Execution of types. There are two ways to pass through SSH Verification method for accessing machines:
- Password based verification: This method requires the user to enter a password for authentication.
- Public key based verification: This method uses public key encryption technology for identity verification. It involves generating a pair of keys on the client side (Public key and private key), And add the public key to HyperAI. The private key is securely stored on the local machine. And used for authentication without the need for a password.
Only in operation "Jupyter working space" Only then can it pass SSH Protocol Access.
Use password
After the workspace is successfully created. The page will appear ssh Login related information. A password will also be created for the container. This password can be used to complete the task SSH Identity verification. No further steps required.
As shown in the above figure, click "Copy password" that will do.
Use public key
By completing the following steps, it can be achieved SSH Visited:
- towards HyperAI Upload personal information SSH Public key
- Add locally HyperAI SSH Access configuration
- By command
ssh root@xxx -pxxxx
realization SSH Sign in
Prepare 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
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
- open
~/.ssh
catalogue (Windows Below is the user directory.ssh
catalogue), Open in Editorid_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. - 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.
stay install bayes Command line tools understand bayes Installation method of command-line tools.
1. Obtain ssh login information
Starting up "working space" after. Its page will display ssh login information. As shown in the following figure:
click "Copy command" You can copy the command to the clipboard. The command line is displayed as follows:
ssh root@ssh. HyperAI.com -p30360
among root
For username, ssh. HyperAI.com
For server address. Perhaps it is IP It could also be HyperAI Other designated domain names, 30360
For port number.
2. Login to run Jupyter working space
Paste the above command onto the command line or fill in the information to other supports according to the above ssh It can be implemented in the client through ssh Login to run Jupyter working space.
If you haven't uploaded the local public key. Then in this step, it is necessary to paste SSH Login password.
3. WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED
If ssh
Paste the login command into the command line to display the error message as shown above. That requires an additional step to resolve this conflict.
Enter the following information at the command line:
ssh-keygen -R [ssh. HyperAI.com]:<The port of your workspace>
Then paste again from "working space" Copied ssh
Just give the command.
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. Install VS Code SSH plug-in unit
Install the above plugin.
2. Stay VS Code Medium configuration ssh connect
Click on the bottom left corner. Open remote window.
Select in the command panel "Connect to Host..." And enter the car. Scroll to the bottom of the dropdown menu, notice "Add New SSH Host.." , Click to add a new one SSH connect.
Enter the complete ssh command. After clicking enter, use the default ssh configuration file. No need to modify.
Click again vscode Remote window in the bottom left corner, click "Connect to Host..." , Select the already configured one SSH connect, click "Connect" Just connect.
3. Modify default access directory
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.
4. Install additional plugins to support Jupyter Execution of files
stay ssh In the case of remote login. If you need to execute inside the container .ipynb
file. Corresponding plugins need to be installed.
new file main.ipynb
After double clicking, it will be displayed in the upper right corner of the page Select Kernel
After clicking, it will require the installation of plugins:
Follow the prompts, click "Install in SSH..." .
After installation, return to the previous one main.ipynb
page. Found that the default option has been selected in the upper right corner kernel
I got it. And it can be executed python Ordered it.