Using a Notebook Instance Remotely with SSH
This topic describes how to use CMD and MobaXterm to remotely log in to a notebook instance using SSH in a Windows environment.
Constraints
To connect to a notebook instance using SSH, pay attention to the following constraints:
- The local user key and permission must match.
- The local user key must be stored in the specified directory.
- Windows: C:\Users\{{user}}
- macOS/Linux: ~
On macOS and Linux, ~ indicates the home directory of the current user.
- The ma-user or root user in the remote image cannot be locked.
- Set the permission on the remote ~/.ssh directory to 750 or 755.
- The OpenSSH version on the local or remote server cannot be earlier than 8.0.
- Do not create more than 10 connections at the same time.
If SSH connection problems occur, rectify the fault by referring to Accessing a Notebook Instance Using SSH for Troubleshooting.
Prerequisites
- You have created an account key pair on the DEW console and saved the key file to a specified directory. For details, see Creating a Key Pair.
- Windows: C:\Users\{{user}}
- macOS/Linux: ~
If you choose I agree to host the private key of the key pair when creating a key pair, you can download the key again by clicking Export Private Key on the Account Key Pairs page. If you do not choose this option, the key will only be available for download once, during creation. Keep your key safe.Figure 1 Creating an account key pair
- You have created a notebook instance with remote SSH enabled (select the created account key pair). The instance is in the Running state.
- For details about how to create a notebook instance, see Creating a Notebook Instance (New Page).
- For details about how to enable remote SSH for an existing notebook instance, see Configuring Remote SSH Connection for a Notebook Instance.
- On the notebook instance details page, obtain the access address for remote SSH development from the basic information tab. Figure 2 Creating a notebook instance for remote SSH development
Figure 3 Notebook instance details page
Method 1: Connecting to a Notebook Instance Using CMD
The following uses Windows as an example.
- Open CMD.
- Option A: Using the start menu
- Click the start button in the lower-left corner of your screen, or press the Windows key on your keyboard.
- Type CMD in the start menu and click Command Prompt.
- Option B: Using the run dialog box
- Press Windows + R on your keyboard to open the Run dialog box.
- Type CMD and press Enter or click OK.
- Option A: Using the start menu
- In CMD, navigate to the directory where your key file is located and execute the following command to connect to the notebook instance:
ssh -o StrictHostKeyChecking=no -i {key-file-name} {launch-user}@{domain-name} -p {port}Note: Replace {key-file-name}, {launch-user}, {domain-name}, and {port} with your actual information obtained from the Prerequisites.
Example: If your key file name is KeyPair-1234-test.pem, and the remote SSH access address is ssh://ma-user@authoring-ssh-modelarts-*****.huawei.com:31092 (where ma-user is the launch user, authoring-ssh-modelarts-*****.huawei.com is the domain name, and 31092 is the port), the command will be:
ssh -o StrictHostKeyChecking=no -i KeyPair-1234-test.pem ma-user@authoring-ssh-modelarts-*****.huawei.com -p 31092
As shown in the figure below, the appearance of the interactive interface indicates a successful connection.
Figure 4 Connecting to a notebook instance using CMD
Method 2: Connecting to a Notebook Instance Using MobaXterm
- Download and install MobaXterm.
- Open MobaXterm, click Session in the upper-left corner, and navigate to the SSH tab in the Session settings dialog box. Configure the Remote host, Username, Port, and Use private key, and click OK. Figure 5 Configuring a session
Obtain the remote SSH access address and the key file path from the Prerequisites. For example, if the remote SSH access address is ssh://ma-user@authoring-ssh-modelarts-*****.huawei.com:31092, configure the settings as follows.
Table 1 Parameters Parameter
Description
Example Value
Basic SSH settings
Remote host
The address of the remote host, obtained from the remote SSH access address.
authoring-ssh-modelarts-*****.huawei.com
Username
The username used to connect to the remote host, obtained from the remote SSH access address.
ma-user
Port
The port number used to connect to the remote host, obtained from the remote SSH access address.
31092
Advanced SSH settings
Use private key
The local file path of your private key, obtained from the Prerequisites.
C:\Users\***\KeyPair-1234-test.pem
As shown in the figure below, the appearance of the interactive interface indicates a successful connection.
Figure 6 Connecting to a notebook instance using MobaXterm
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot