Chen Yulin's BlogChen Yulin's Blog
HomeArchivesCategoriesTagsAbout
  • Tags
  • SSH
Use SSH to Connect Jupyter-lab
Posted 2024-12-10Updated 2025-05-23Notea minute read (About 174 words)

Use SSH to Connect Jupyter-lab

使用ssh作为命令行远程工具,启动远程的jupyter lab并且在本地的浏览器中打开。

远程运行:

1
jupyter lab --no-browser --port=8080

--no-broswer is very important

output:

1
2
3
4
5
6
7
8
9
10
...
[I 2024-12-10 14:30:24.585 ServerApp] http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c
[I 2024-12-10 14:30:24.586 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-12-10 14:30:24.603 ServerApp]

To access the server, open this file in a browser:
file:///home/bohanfeng/.local/share/jupyter/runtime/jpserver-11659-open.html
Or copy and paste one of these URLs:
http://localhost:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c
http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c

本地运行:

1
ssh -L 8080:localhost:8080 bohanfeng@192.168.2.102

本地浏览器访问:
http://127.0.0.1:8080/lab?token=0061d1eb31396b1bc3cd77a7161b2084da1dedcdeca0600c

ssh
Posted 2023-05-10Updated 2025-05-234 minutes read (About 577 words)

ssh

  • SSH Overview
    • SSH Keys
    • SSH Agent
    • Generating a New SSH Key Pair
    • Adding a Key to the SSH Agent on Ubuntu
    • Viewing Keys in the SSH Agent on Ubuntu

SSH Overview

SSH (Secure Shell) is a network security protocol that provides secure access and file transfer through encryption and authentication mechanisms. It encrypts and verifies network data to provide secure login and other secure network services.

SSH Keys

SSH uses a combination of public and private keys to secure communication. The public key is used to encrypt data, while the private key is used to decrypt data. This ensures that even if data is intercepted during transmission, attackers cannot decrypt it, ensuring data security.

SSH Agent

An SSH agent is a program that stores private keys and can help you avoid having to enter your passphrase every time you use SSH. When you add a private key to an SSH agent, you only need to enter the passphrase the first time you use the key. After that, the SSH agent will automatically provide the private key for you.

Generating a New SSH Key Pair

You can use the ssh-keygen tool to generate a new SSH key pair. Here’s an example of how to use ssh-keygen to generate an RSA key pair:

1
ssh-keygen -t rsa -b 4096 -C “your_email@example.com”

In this command:

  • -t rsa specifies the type of key to create. In this case, we’re creating an RSA key.
  • -b 4096 specifies the number of bits in the key. In this case, we’re creating a 4096-bit key.
  • -C "your_email@example.com" adds a comment to the key. This can be any text you like, but it’s common to use your email address.

After running this command, ssh-keygen will prompt you for a location to save the key pair and for a passphrase to secure the private key. You can accept the default location by pressing Enter, or you can specify a different location if you prefer. If you don’t want to use a passphrase, you can leave it blank by pressing Enter.

Adding a Key to the SSH Agent on Ubuntu

On Ubuntu, you can add a key to the ssh-agent by following these steps:

  1. Open the terminal.
  2. Make sure ssh-agent is running. You can start it by running the eval "$(ssh-agent -s)" command.
  3. Run the ssh-add ~/.ssh/id_rsa command to add your first key (the one you commonly use) to the ssh-agent. If your key file is not in the default location (i.e., ~/.ssh/id_rsa), replace the path in the command with the actual path of your key file.
  4. If your key has a passphrase, you will be prompted to enter it. Enter the passphrase and press Enter.

After completing these steps, you have successfully added your first key to the ssh-agent. Now when you use SSH to connect to a remote server, the ssh-agent will automatically provide your private key.

Viewing Keys in the SSH Agent on Ubuntu

On Ubuntu, you can view the keys added to the ssh-agent by running the ssh-add -l command. This command lists the fingerprints of all keys in the ssh-agent.

Chen Yulin

Chen Yulin

SJTU student

Manchester by the Sea

Posts

262

Categories

8

Tags

188

Follow

Archives

  • May 20258
  • April 202517
  • March 202545
  • February 202512
  • January 202513
  • December 202412
  • November 20244
  • October 202418
  • September 202417
  • August 202413
  • July 20243
  • June 20245
  • May 202413
  • April 202417
  • March 20241
  • January 20241
  • December 20231
  • May 202346
  • August 20221
  • May 20226
  • April 20229

Recents

2025-05-19

2025 Disneyland

Note

Matlab on Archlinux

2025-05-13

Matlab on Archlinux

Note

2025-05-13

Part-level Dataset Available for Augmentation

Note

Feature Pyramid Networks for Object Detection

2025-05-08

Feature Pyramid Networks for Object Detection

Review

Write Latex in Neovim on Archlinux

2025-05-07

Write Latex in Neovim on Archlinux

Note

Tags

3D-Scene4
6-D3
AI10
AIGC1
AR2
Academic1
Algorithm1
Aliyun1
App2
Atlas1
BS41
Beautify1
Behaviorism1
Business1
C1
CADC1
CD1
CLIP5
CNN1
CV28
Capstone10
Communication2
Contrastive-Learning3
Control2
Csharp9
Css1
Cuda3
DD1
DINO4
DT1
Dataframe1
Debate5
Debugger1
Diffusion1
Discrete-Mathematics1
Disney1
Docker1
Docs2
Dynamic-programming1
ESP322
Education1
Embeded-System9
Embodied-AI8
Emoation1
Emotion12
Ethic1
FL1
FPN2
Family1
Federated-Learning1
Foundation1
Functional programming1
GPT3
Game5
Gated-NN2
Git7
Github1
Godot3
HPC1
HRI2
Haskell1
Health2
Hexo10
Hierarchical1
Html5
Humanism1
Hyprland2
IK1
Image-Grounding1
Image-Text5
Image-generation1
ImitationLearning3
Jolt1
Json1
LLM12
LSP2
Latex2
Life4
LinearAlgebra1
Linux21
Live2d1
Love3
Lua1
MBTI1
ML5
MR/AR3
Mason1
Math3
Meme1
Message-Passing1
Mod3
Motivation1
Movie1
Multi-modal6
Multi-view1
Music5
NLP4
NN4
Network2
Nodejs5
Numpy1
Nvim9
Object-Detection4
Open-Vocabulary9
OpenCV1
Oral1
PHD1
PSY5
Pandas2
Panoptic1
Path1
Philosophy3
PhysX1
Physical-Scene4
Physics-engine1
Pio2
Planning1
Plugin8
PoseEstimation3
Postgraduate1
Prefab1
Probability1
Python26
Pytorch1
QML1
Quantum1
RNN4
ROS3
Reading19
Real2Sim1
Reconstruct9
Regex2
Reinforcement-learning1
Repository5
Representation-Learning1
Research-paper86
Robot1
Robotics16
SJTU-Lecture1
SQL2
SSH2
Scene-graph29
Scene-synthesis1
Science-fiction1
Scrap1
Script2
Segmentation7
Semantic12
Shader3
Shell4
Signals and Systems1
Sim2Real1
Sklearn1
Snippets1
Society4
Star-rail1
Subgraph1
Submodule1
Supervised-learning2
Survey3
TC1
TOEFL1
Task-Planning6
Tasks4
Tech Communication1
Torch4
Transformer11
Translation-Embedding2
Travel3
Unity20
Unsupervised-learning1
VLM5
VLP2
Version-management1
ViT4
VideoEditing2
Vim1
Visual-Relation20
WSL1
Waybar1
Wayland1
Web1
Website1
Well-being1
Window-manager2
YKLL3
Zen2
🐱1
Chen Yulin's BlogChen Yulin's Blog

© 2025 Chen Yulin  Powered by Hexo & Icarus

×