Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Run Jupyter Notebook on a VPS and Connect via SSH Tunnel

A practical, security-conscious guide to running JupyterLab on a VPS and accessing it through an SSH tunnel, with exact commands, port mapping, authentication, persistence, and troubleshooting.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run Jupyter on the VPS loopback address, then forward that port to your computer with OpenSSH. The complete workflow is: install JupyterLab in a Python environment, start it with --no-browser --ip=127.0.0.1, create an SSH local port forward, and open the forwarded address in your local browser. The notebook remains unreachable from the public internet, while the Jupyter token still provides application-level authentication.

What this setup does

A VPS is a remote Linux computer with a public network address. JupyterLab runs on that computer, but the web server can listen only on its loopback interface, 127.0.0.1. That address is reachable from the VPS itself, not directly from the internet.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An SSH tunnel makes a port on your own computer act as a secure entrance to the VPS-side port. Your browser connects to a local URL such as http://127.0.0.1:8888; SSH carries the requests through the encrypted session to Jupyter on the VPS. You do not need to open TCP port 8888 in the VPS firewall for this arrangement.

This is a single-user pattern. The Jupyter token or password remains important even though the service is bound to localhost: anyone who gains access to your VPS account or to the forwarded local port could otherwise reach the web application.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Prerequisites and planning

What you need

  • A Linux VPS that you can reach with SSH.
  • A non-root VPS account with permission to install packages and run your project.
  • An SSH client on your local computer. OpenSSH is available by default on most Linux and macOS systems; current Windows versions also provide ssh in PowerShell and Windows Terminal.
  • A Python environment for the project, created with conda, mamba, or a standard virtual environment.
  • JupyterLab installed inside that environment.
  • A local browser and a second local terminal, because one terminal will keep the tunnel open.

Choose ports deliberately

8888 is a common example and Jupyter’s familiar default, not a required or universal port. The remote port must be the port on which Jupyter is listening. The local port only needs to be free on your computer; it can be different from the remote port.

Component Example Meaning
VPS bind address 127.0.0.1 Jupyter accepts connections from the VPS loopback interface.
VPS Jupyter port 8888 The port used by the Jupyter process on the VPS.
Local browser port 8888 or 8890 The port your browser uses after SSH creates the tunnel.

1. Log in and prepare a non-root account

Connect to the VPS from your local terminal using the account supplied by your VPS setup:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh USER@VPS_HOST

Use a dedicated account for notebooks rather than running the server as root. A project-specific account limits the damage from an application mistake and keeps files, environments, and credentials separate from system administration.

Once logged in, confirm that Python is available and decide where the project will live. A typical project directory might be ~/projects/my-notebook. Keep data and notebooks in a location that is included in your backup or snapshot plan; a running Jupyter process is not a backup.

2. Create or activate the Python environment

Install Jupyter in the same environment that contains your project libraries. Otherwise, the server may start successfully while notebook kernels cannot import the packages your code needs.

Conda or mamba

Activate an existing environment, or create one with the Python version your project requires:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
conda activate my-project

If the environment does not exist yet, create it first with your chosen environment manager, then activate it before installing JupyterLab.

Python virtual environment and pip

From the project directory, create and activate a virtual environment:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
python3 -m venv .venv
source .venv/bin/activate

Install JupyterLab with pip:

python -m pip install --upgrade pip
python -m pip install jupyterlab

Project Jupyter documents conda, mamba, and pip as installation routes. Whichever route you use, verify that the executable resolves inside the activated environment:

which jupyter
jupyter lab --version

If which jupyter points to a system location instead of your environment, activate the environment again and install JupyterLab there. Do not mix a system Jupyter executable with kernels and libraries installed in a different environment unless you have intentionally configured that arrangement.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Start Jupyter on the VPS without opening a browser

A VPS normally has no graphical desktop, so tell Jupyter not to launch a browser. Bind it to loopback and choose a free port:

jupyter lab --no-browser --ip=127.0.0.1 --port=8888

The process prints a URL containing an authentication token. Leave this terminal running. Copy the token-bearing URL privately, or copy only the token and use the local URL after the tunnel is active.

If port 8888 is already occupied, select another remote port:

jupyter lab --no-browser --ip=127.0.0.1 --port=8891

The server options control three important behaviors here:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • --no-browser prevents a browser-launch attempt on the headless VPS.
  • --ip=127.0.0.1 keeps the listener on the VPS loopback interface instead of a public network interface.
  • --port=... selects the TCP port Jupyter listens on.

Jupyter Server generates a token by default. Do not configure an empty token merely to avoid pasting credentials: setting the token to an empty string disables authentication altogether and is explicitly not recommended. Keep the printed URL and token out of public issue trackers, screenshots, shell transcripts, and shared chats.

4. Create the SSH tunnel from your computer

Open a second terminal on your local computer; do not run this command in the VPS terminal that is hosting Jupyter. Forward a local port to the VPS loopback address and the Jupyter port:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
ssh -N -L 8888:127.0.0.1:8888 USER@VPS_HOST

OpenSSH’s -L option creates a local listening port and forwards traffic through the SSH connection to the specified host and port on the remote side. The explicit 127.0.0.1 target means the SSH server connects to Jupyter through the VPS loopback interface. The -N option tells SSH not to run a remote shell command; this terminal is dedicated to forwarding.

When local port 8888 is busy

Keep the VPS-side port at 8888 and choose another free port on your computer:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh -N -L 8890:127.0.0.1:8888 USER@VPS_HOST

The first number is the local listening port. The final number is the remote Jupyter port. Browse to http://127.0.0.1:8890 in this example.

When Jupyter uses a different remote port

If Jupyter was started on 8891, map the remote side to 8891:

ssh -N -L 8888:127.0.0.1:8891 USER@VPS_HOST

You can also use a different local port at the same time:

ssh -N -L 8890:127.0.0.1:8891 USER@VPS_HOST
SSH segment Example value Role
Local listen port 8890 Port opened on your computer for the browser.
Forward target address 127.0.0.1 Address resolved from the VPS side of the SSH connection.
Remote target port 8888 Port where Jupyter is listening on the VPS.

5. Open Jupyter in the browser

With both the Jupyter process and SSH tunnel running, open the local address that matches the first number in your -L option:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use http://127.0.0.1:8888 when the command starts with -L 8888:....
  • Use http://127.0.0.1:8890 when the command starts with -L 8890:....

Paste the token from the VPS terminal when Jupyter asks for it. If you copied the complete token-bearing URL, use that URL only on your own computer and verify that its host and port correspond to the local tunnel.

Keep the browser host as 127.0.0.1. Substituting the VPS public hostname can trigger host-header checks or a 403 response because the request is no longer addressed as a local connection.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

6. Keep the server and tunnel available

Manual sessions

The SSH tunnel exists only while its SSH process is connected. Likewise, Jupyter stops when the terminal running it receives Ctrl-C. For a short session, use this simple sequence:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Start Jupyter in the VPS terminal.
  2. Start the SSH tunnel in a second local terminal.
  3. Work in the browser.
  4. Press Ctrl-C in the local tunnel terminal when finished.
  5. Press Ctrl-C in the VPS Jupyter terminal to stop the server.

Long-running work

If a notebook job must survive closing your terminal, run Jupyter inside a terminal multiplexer such as tmux and keep the SSH tunnel separate. A typical pattern is:

tmux new -s jupyter
jupyter lab --no-browser --ip=127.0.0.1 --port=8888

Detach from the multiplexer with its detach keystroke, then reconnect later with:

tmux attach -t jupyter

This keeps the process alive across an SSH disconnect, but it does not automatically restart Jupyter after a VPS reboot. For reboot persistence, use a service manager such as systemd and configure it to run as the dedicated user, from the project directory, with the intended environment and loopback bind. Treat the service definition as infrastructure: restrict its file permissions, decide how the token is supplied, and test both startup and shutdown before relying on it.

Security boundaries you should preserve

Local binding is not the same as authentication

Loopback binding prevents unsolicited internet connections to the notebook port, but it does not replace Jupyter’s token or password. Leave authentication enabled and protect the VPS account and SSH key as carefully as the notebook data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not bind publicly by accident

Changing --ip=127.0.0.1 to --ip=0.0.0.0 or a public address exposes Jupyter to interfaces beyond the VPS itself. That changes the firewall, TLS, and access-control requirements. A public deployment should use HTTPS and authentication, with deliberate firewall rules and a documented way to rotate credentials.

Use least privilege

  • Run Jupyter as the project user, not root, unless a specific deployment requirement has been reviewed.
  • Keep private keys, tokens, environment files, and notebook data outside publicly served directories.
  • Use VPS firewall rules to limit SSH access where practical, while leaving the Jupyter port closed to the public internet for an SSH-only workflow.
  • Rotate a token or password if it appears in a shared log, screenshot, ticket, or chat.

Know when this pattern is insufficient

This design suits one person or a tightly controlled workstation. It is not a multi-user access-control system. Teams that need separate users, centrally managed authentication, shared kernels, or policy-based access should evaluate a multi-user architecture rather than sharing one personal Jupyter process.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

SSH tunnel versus other deployment choices

The right option depends on who needs access and how much infrastructure you are prepared to operate.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Option Exposure Authentication Persistence Audience Operational burden
Loopback plus SSH tunnel Jupyter port stays private; access is through SSH. SSH access plus Jupyter token or password. Manual process, multiplexer, or a service manager. Usually one user. Low once SSH access works; each user needs a tunnel.
Public Jupyter behind HTTPS Reachable through a public hostname and firewall rule. Token, password, or an additional access layer. Normally managed as a service. Selected remote users. Higher: TLS certificates, firewalling, updates, logging, and access control.
Multi-user server architecture Published through a designed gateway or proxy. Per-user identity, often with centralized authentication. Managed services and user spawning. Teams or classes. Highest: administration, upgrades, resource limits, and policy.

A direct public deployment can be simpler for a controlled team in some environments, but it carries responsibilities that the tunnel avoids. For an individual using a VPS from a trusted computer, the loopback-and-tunnel pattern minimizes exposed surface area without requiring a public notebook endpoint.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

VPS sizing and location decisions

There is no single VPS size for Jupyter. Select resources from the workload rather than from the port number:

  • CPU: matters for compilation, data transformation, simulations, and parallel kernels.
  • RAM: determines how large a dataset and how many kernels can remain in memory before swapping.
  • Storage: must cover the operating system, environments, package caches, datasets, notebook outputs, and snapshots.
  • Region: a nearby region usually improves interactive terminal and browser responsiveness; data residency requirements may dictate another region.
  • Bandwidth: large dataset transfers and rendered outputs consume more bandwidth than ordinary notebook interaction.
  • Snapshots and backups: useful for recovery, but they do not replace exporting important notebooks and data.
  • IPv6 and support: can affect how you reach the VPS and troubleshoot networking, even though the SSH tunnel itself does not require Jupyter to be publicly reachable.

Start with the smallest instance that comfortably fits the environment and dataset, then watch memory, CPU, disk, and network usage during real jobs. Upgrade based on observed pressure rather than treating 8888 as a capacity indicator.

Troubleshooting by symptom

The browser refuses the connection

  • Confirm that the Jupyter process is still running in the VPS terminal.
  • Check that the browser port equals the first number in the SSH -L argument.
  • Confirm that the remote port equals the port shown in Jupyter’s startup output.
  • Make sure the SSH terminal has not exited or been suspended.

SSH reports that the local port is busy

Another local application owns that port. Choose a free local port, such as 8890, while leaving the remote target unchanged, then browse to the new local port.

Jupyter printed a different port

Either stop the conflicting process and restart Jupyter on your chosen port, or change the final number in the tunnel to the actual remote port. The local browser port and remote Jupyter port do not have to match.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The page returns 403 or a host-header error

Use http://127.0.0.1:local-port in the browser rather than the VPS hostname. Review Jupyter’s allow_remote_access setting only when a reverse proxy or an intentionally non-local hostname is part of the design; it is not a reason to weaken a straightforward localhost tunnel.

The tunnel connects but the page hangs

  • Verify that Jupyter is listening on the VPS loopback address and the port you forwarded.
  • Check that the SSH account can reach that address and port from the VPS.
  • Run the tunnel with verbose logging to inspect connection details:
ssh -v -N -L 8888:127.0.0.1:8888 USER@VPS_HOST

Use the resulting log to distinguish an SSH forwarding problem from a Jupyter process or VPS resource problem; do not assume a particular fix without examining the error.

The session disconnects unexpectedly

Reconnect the tunnel and check whether the VPS process survived. Inspect SSH verbose output, VPS memory and disk pressure, and any service-manager logs if Jupyter is managed as a service. A terminal multiplexer can protect a manual process from an ordinary SSH disconnect, but it cannot correct a VPS reboot, an out-of-memory kill, or a full disk.

Safe shutdown and repeatable startup

For a manual run, stop the local tunnel first with Ctrl-C, then stop Jupyter with Ctrl-C in the VPS session. On the next run, activate the same project environment, launch Jupyter on the intended loopback port, and recreate the SSH forward with a local port that is free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Write down the environment name, project directory, remote port, local port, and startup command in a private operations note. Do not store the live token in that note. This small record prevents the most common repeat-run errors: activating the wrong environment, forwarding the wrong remote port, or opening the wrong local browser address.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.